Merge "Fix global objects and singletons in NewParserTest"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul>
2380 <li>
2381 <ol>
2382 <li>
2383 <ul>
2384 <li>
2385 <ol>
2386 <li>
2387 <dl>
2388 <dt>
2389 <ul>
2390 <li>
2391 <dl>
2392 <dt>
2393 <dl>
2394 <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2395 <dd data-parsoid='{"stx":"row"}'>bar</dd></dl></dt></dl></li></ul></dt>
2396 <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2397 <dd data-parsoid='{"stx":"row"}'>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2398 !! end
2399
2400
2401 !! test
2402 Definition Lists: Weird Ones: Test 1 (php)
2403 !! options
2404 php
2405 !! input
2406 *#;*::;; foo : bar (who uses this?)
2407 !! result
2408 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2409 </dt></dl>
2410 </dd></dl>
2411 </dd></dl>
2412 </dd></dl>
2413 </li></ul>
2414 </dd></dl>
2415 </li></ol>
2416 </li></ul>
2417
2418 !! end
2419 !! test
2420 Definition Lists: Weird Ones: Test 1 (parsoid)
2421 !! options
2422 parsoid
2423 !! input
2424 *#;*::;; foo : bar (who uses this?)
2425 !! result
2426 <ul>
2427 <li>
2428 <ol>
2429 <li>
2430 <dl>
2431 <dt>
2432 <ul>
2433 <li>
2434 <dl>
2435 <dd>
2436 <dl>
2437 <dd>
2438 <dl>
2439 <dt>
2440 <dl>
2441 <dt> foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
2442 <dd data-parsoid='{"stx":"row"}'> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2443 !! end
2444
2445 ###
2446 ### External links
2447 ###
2448 !! test
2449 External links: non-bracketed
2450 !! input
2451 Non-bracketed: http://example.com
2452 !! result
2453 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2454 </p>
2455 !! end
2456
2457 !! test
2458 External links: numbered
2459 !! input
2460 Numbered: [http://example.com]
2461 Numbered: [http://example.net]
2462 Numbered: [http://example.com]
2463 !! result
2464 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2465 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2466 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2467 </p>
2468 !!end
2469
2470 !! test
2471 External links: specified text
2472 !! input
2473 Specified text: [http://example.com link]
2474 !! result
2475 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2476 </p>
2477 !!end
2478
2479 !! test
2480 External links: trail
2481 !! input
2482 Linktrails should not work for external links: [http://example.com link]s
2483 !! result
2484 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2485 </p>
2486 !! end
2487
2488 !! test
2489 External links: dollar sign in URL
2490 !! input
2491 http://example.com/1$2345
2492 !! result
2493 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2494 </p>
2495 !! end
2496
2497 !! test
2498 External links: dollar sign in URL (named)
2499 !! input
2500 [http://example.com/1$2345]
2501 !! result
2502 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2503 </p>
2504 !!end
2505
2506 !! test
2507 External links: open square bracket forbidden in URL (bug 4377)
2508 !! input
2509 http://example.com/1[2345
2510 !! result
2511 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2512 </p>
2513 !! end
2514
2515 !! test
2516 External links: open square bracket forbidden in URL (named) (bug 4377)
2517 !! input
2518 [http://example.com/1[2345]
2519 !! result
2520 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2521 </p>
2522 !!end
2523
2524 !! test
2525 External links: nowiki in URL link text (bug 6230)
2526 !!input
2527 [http://example.com/ <nowiki>''example site''</nowiki>]
2528 !! result
2529 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2530 </p>
2531 !! end
2532
2533 !! test
2534 External links: newline forbidden in text (bug 6230 regression check)
2535 !! input
2536 [http://example.com/ first
2537 second]
2538 !! result
2539 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2540 second]
2541 </p>
2542 !!end
2543
2544 !! test
2545 External links: Pipe char between url and text
2546 !! input
2547 [http://example.com | link]
2548 !! result
2549 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2550 </p>
2551 !!end
2552
2553 !! test
2554 External links: protocol-relative URL in brackets
2555 !! input
2556 [//example.com/ Test]
2557 !! result
2558 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2559 </p>
2560 !! end
2561
2562 !! test
2563 External links: protocol-relative URL in brackets without text
2564 !! input
2565 [//example.com]
2566 !! result
2567 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2568 </p>
2569 !! end
2570
2571 !! test
2572 External links: protocol-relative URL in free text is left alone
2573 !! input
2574 //example.com/Foo
2575 !! result
2576 <p>//example.com/Foo
2577 </p>
2578 !!end
2579
2580 !! test
2581 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2582 !! input
2583 foo//example.com/Foo
2584 !! result
2585 <p>foo//example.com/Foo
2586 </p>
2587 !! end
2588
2589 !! test
2590 External image
2591 !! input
2592 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2593 !! result
2594 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2595 </p>
2596 !! end
2597
2598 !! test
2599 External image from https
2600 !! input
2601 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2602 !! result
2603 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2604 </p>
2605 !! end
2606
2607 !! test
2608 Link to non-http image, no img tag
2609 !! input
2610 Link to non-http image, no img tag: ftp://example.com/test.jpg
2611 !! result
2612 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2613 </p>
2614 !! end
2615
2616 !! test
2617 External links: terminating separator
2618 !! input
2619 Terminating separator: http://example.com/thing,
2620 !! result
2621 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2622 </p>
2623 !! end
2624
2625 !! test
2626 External links: intervening separator
2627 !! input
2628 Intervening separator: http://example.com/1,2,3
2629 !! result
2630 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2631 </p>
2632 !! end
2633
2634 !! test
2635 External links: old bug with URL in query
2636 !! input
2637 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2638 !! result
2639 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2640 </p>
2641 !! end
2642
2643 !! test
2644 External links: old URL-in-URL bug, mixed protocols
2645 !! input
2646 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2647 !! result
2648 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2649 </p>
2650 !!end
2651
2652 !! test
2653 External links: URL in text
2654 !! input
2655 URL in text: [http://example.com http://example.com]
2656 !! result
2657 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2658 </p>
2659 !! end
2660
2661 !! test
2662 External links: Clickable images
2663 !! input
2664 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2665 !! result
2666 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2667 </p>
2668 !!end
2669
2670 !! test
2671 External links: raw ampersand
2672 !! input
2673 Old &amp; use: http://x&y
2674 !! result
2675 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2676 </p>
2677 !! end
2678
2679 !! test
2680 External links: encoded ampersand
2681 !! input
2682 Old &amp; use: http://x&amp;y
2683 !! result
2684 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2685 </p>
2686 !! end
2687
2688 !! test
2689 External links: encoded equals (bug 6102)
2690 !! input
2691 http://example.com/?foo&#61;bar
2692 !! result
2693 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2694 </p>
2695 !! end
2696
2697 !! test
2698 External links: [raw ampersand]
2699 !! input
2700 Old &amp; use: [http://x&y]
2701 !! result
2702 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2703 </p>
2704 !! end
2705
2706 !! test
2707 External links: [encoded ampersand]
2708 !! input
2709 Old &amp; use: [http://x&amp;y]
2710 !! result
2711 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2712 </p>
2713 !! end
2714
2715 !! test
2716 External links: [encoded equals] (bug 6102)
2717 !! input
2718 [http://example.com/?foo&#61;bar]
2719 !! result
2720 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2721 </p>
2722 !! end
2723
2724 !! test
2725 External links: [IDN ignored character reference in hostname; strip it right off]
2726 !! input
2727 [http://e&zwnj;xample.com/]
2728 !! result
2729 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2730 </p>
2731 !! end
2732
2733 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2734 # Where an external link could easily circumvent the sanitization of the text of
2735 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2736 # test demands a higher standard. That's a bit strange.
2737 #
2738 # Example:
2739 #
2740 # http://e‌xample.com -> [http://example.com|http://example.com]
2741 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2742 #
2743 # The first example is sanitized, but the second is not. Any security benefits
2744 # from this production are trivial to circumvent. Either remove this test and
2745 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2746 # the test accordingly.
2747 #
2748 # All our love,
2749 # The Parsoid team.
2750 !! test
2751 External links: IDN ignored character reference in hostname; strip it right off
2752 !! input
2753 http://e&zwnj;xample.com/
2754 !! result
2755 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2756 </p>
2757 !! end
2758
2759 !! test
2760 External links: www.jpeg.org (bug 554)
2761 !! input
2762 http://www.jpeg.org
2763 !!result
2764 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2765 </p>
2766 !! end
2767
2768 !! test
2769 External links: URL within URL (original bug 2)
2770 !! input
2771 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2772 !! result
2773 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2774 </p>
2775 !! end
2776
2777 !! test
2778 BUG 361: URL inside bracketed URL
2779 !! input
2780 [http://www.example.com/foo http://www.example.com/bar]
2781 !! result
2782 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2783 </p>
2784 !! end
2785
2786 !! test
2787 BUG 361: URL within URL, not bracketed
2788 !! input
2789 http://www.example.com/foo?=http://www.example.com/bar
2790 !! result
2791 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2792 </p>
2793 !! end
2794
2795 !! test
2796 BUG 289: ">"-token in URL-tail
2797 !! input
2798 http://www.example.com/<hello>
2799 !! result
2800 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2801 </p>
2802 !!end
2803
2804 !! test
2805 BUG 289: literal ">"-token in URL-tail
2806 !! input
2807 http://www.example.com/<b>html</b>
2808 !! result
2809 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2810 </p>
2811 !!end
2812
2813 !! test
2814 BUG 289: ">"-token in bracketed URL
2815 !! input
2816 [http://www.example.com/<hello> stuff]
2817 !! result
2818 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2819 </p>
2820 !!end
2821
2822 !! test
2823 BUG 289: literal ">"-token in bracketed URL
2824 !! input
2825 [http://www.example.com/<b>html</b> stuff]
2826 !! result
2827 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2828 </p>
2829 !!end
2830
2831 !! test
2832 BUG 289: literal double quote at end of URL
2833 !! input
2834 http://www.example.com/"hello"
2835 !! result
2836 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2837 </p>
2838 !!end
2839
2840 !! test
2841 BUG 289: literal double quote in bracketed URL
2842 !! input
2843 [http://www.example.com/"hello" stuff]
2844 !! result
2845 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2846 </p>
2847 !!end
2848
2849 !! test
2850 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2851 !! input
2852 [http://www.example.com test]
2853 !! result
2854 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2855 </p>
2856 !! end
2857
2858 !! test
2859 External links: link text with spaces
2860 !! input
2861 [http://www.example.com a b c]
2862 [http://www.example.com ''a'' ''b'']
2863 !! result
2864 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2865 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2866 </p>
2867 !! end
2868
2869 !! test
2870 External links: wiki links within external link (Bug 3695)
2871 !! input
2872 [http://example.com [[wikilink]] embedded in ext link]
2873 !! result
2874 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2875 </p>
2876 !! end
2877
2878 !! test
2879 BUG 787: Links with one slash after the url protocol are invalid
2880 !! input
2881 http:/example.com
2882
2883 [http:/example.com title]
2884 !! result
2885 <p>http:/example.com
2886 </p><p>[http:/example.com title]
2887 </p>
2888 !! end
2889
2890 !! test
2891 Bracketed external links with template-generated invalid target
2892 !! input
2893 [{{echo|http:/example.com}} title]
2894 !! result
2895 <p>[http:/example.com title]
2896 </p>
2897 !! end
2898
2899 !! test
2900 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2901 !! input
2902 ''[http://example.com text'']
2903 [http://example.com '''text]'''
2904 ''Something [http://example.com in italic'']
2905 ''Something [http://example.com mixed''''', even bold]'''
2906 '''''Now [http://example.com both''''']
2907 !! result
2908 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2909 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2910 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2911 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2912 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2913 </p>
2914 !! end
2915
2916
2917 !! test
2918 Bug 4781: %26 in URL
2919 !! input
2920 http://www.example.com/?title=AT%26T
2921 !! result
2922 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2923 </p>
2924 !! end
2925
2926 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2927 # % is actually legal in HTML5. Any change in output would need testing though.
2928 !! test
2929 Bug 4781, 5267: %25 in URL
2930 !! input
2931 http://www.example.com/?title=100%25_Bran
2932 !! result
2933 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2934 </p>
2935 !! end
2936
2937 !! test
2938 Bug 4781, 5267: %28, %29 in URL
2939 !! input
2940 http://www.example.com/?title=Ben-Hur_%281959_film%29
2941 !! result
2942 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2943 </p>
2944 !! end
2945
2946
2947 !! test
2948 Bug 4781: %26 in autonumber URL
2949 !! input
2950 [http://www.example.com/?title=AT%26T]
2951 !! result
2952 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2953 </p>
2954 !! end
2955
2956 !! test
2957 Bug 4781, 5267: %26 in autonumber URL
2958 !! input
2959 [http://www.example.com/?title=100%25_Bran]
2960 !! result
2961 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2962 </p>
2963 !! end
2964
2965 !! test
2966 Bug 4781, 5267: %28, %29 in autonumber URL
2967 !! input
2968 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2969 !! result
2970 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2971 </p>
2972 !! end
2973
2974
2975 !! test
2976 Bug 4781: %26 in bracketed URL
2977 !! input
2978 [http://www.example.com/?title=AT%26T link]
2979 !! result
2980 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2981 </p>
2982 !! end
2983
2984 !! test
2985 Bug 4781, 5267: %26 in bracketed URL
2986 !! input
2987 [http://www.example.com/?title=100%25_Bran link]
2988 !! result
2989 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2990 </p>
2991 !! end
2992
2993 !! test
2994 Bug 4781, 5267: %28, %29 in bracketed URL
2995 !! input
2996 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2997 !! result
2998 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2999 </p>
3000 !! end
3001
3002 !! test
3003 External link containing double-single-quotes in text '' (bug 4598 sanity check)
3004 !! input
3005 Some [http://example.com/ pretty ''italics'' and stuff]!
3006 !! result
3007 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
3008 </p>
3009 !! end
3010
3011 !! test
3012 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
3013 !! input
3014 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
3015 !! result
3016 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
3017 </p>
3018 !! end
3019
3020 !! test
3021 External link containing double-single-quotes with no space separating the url from text in italics
3022 !! input
3023 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
3024 !! result
3025 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
3026 </p>
3027 !! end
3028
3029 !! test
3030 URL-encoding in URL functions (single parameter)
3031 !! input
3032 {{localurl:Some page|amp=&}}
3033 !! result
3034 <p>/index.php?title=Some_page&amp;amp=&amp;
3035 </p>
3036 !! end
3037
3038 !! test
3039 URL-encoding in URL functions (multiple parameters)
3040 !! input
3041 {{localurl:Some page|q=?&amp=&}}
3042 !! result
3043 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3044 </p>
3045 !! end
3046
3047 !! test
3048 Brackets in urls
3049 !! input
3050 http://example.com/index.php?foozoid%5B%5D=bar
3051
3052 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3053 !! result
3054 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3055 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3056 </p>
3057 !! end
3058
3059 !! test
3060 IPv6 urls (bug 21261)
3061 !! options
3062 disabled
3063 !! input
3064 http://[2404:130:0:1000::187:2]/index.php
3065 !! result
3066 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3067 </p>
3068 !! end
3069
3070 !! test
3071 Non-extlinks in brackets
3072 !! input
3073 [foo]
3074 [foo bar]
3075 [foo ''bar'']
3076 [fool's] errand
3077 [fool's errand]
3078 [{{echo|foo}}]
3079 [{{echo|foo}} bar]
3080 [{{echo|foo}} ''bar'']
3081 [{{echo|foo}}l's] errand
3082 [{{echo|foo}}l's errand]
3083 [url={{echo|foo}}]
3084 [url=http://example.com]
3085 !! result
3086 <p>[foo]
3087 [foo bar]
3088 [foo <i>bar</i>]
3089 [fool's] errand
3090 [fool's errand]
3091 [foo]
3092 [foo bar]
3093 [foo <i>bar</i>]
3094 [fool's] errand
3095 [fool's errand]
3096 [url=foo]
3097 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3098 </p>
3099 !! end
3100
3101 ###
3102 ### Quotes
3103 ###
3104
3105 !! test
3106 Quotes
3107 !! input
3108 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3109
3110 Normal text. '''''Bold italic text.''''' Normal text.
3111 !!result
3112 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3113 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3114 </p>
3115 !! end
3116
3117
3118 !! test
3119 Unclosed and unmatched quotes (php)
3120 !! options
3121 php
3122 !! input
3123 '''''Bold italic text '''with bold deactivated''' in between.'''''
3124
3125 '''''Bold italic text ''with italic deactivated'' in between.'''''
3126
3127 '''Bold text..
3128
3129 ..spanning two paragraphs (should not work).'''
3130
3131 '''Bold tag left open
3132
3133 ''Italic tag left open
3134
3135 Normal text.
3136
3137 <!-- Unmatching number of opening, closing tags: -->
3138 '''This year''''s election ''should'' beat '''last year''''s.
3139
3140 ''Tom'''s car is bigger than ''Susan'''s.
3141
3142 Plain ''italic'''s plain
3143 !! result
3144 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3145 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3146 </p><p><b>Bold text..</b>
3147 </p><p>..spanning two paragraphs (should not work).
3148 </p><p><b>Bold tag left open</b>
3149 </p><p><i>Italic tag left open</i>
3150 </p><p>Normal text.
3151 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3152 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3153 </p><p>Plain <i>italic'</i>s plain
3154 </p>
3155 !! end
3156 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3157 # parser strips. The wikitext contains just the first half of the bold
3158 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3159 # differently than the PHP parser.)
3160 !! test
3161 Unclosed and unmatched quotes (parsoid)
3162 !! options
3163 parsoid
3164 !! input
3165 '''''Bold italic text '''with bold deactivated''' in between.'''''
3166
3167 '''''Bold italic text ''with italic deactivated'' in between.'''''
3168
3169 '''Bold text..
3170
3171 ..spanning two paragraphs (should not work).'''
3172
3173 '''Bold tag left open
3174
3175 ''Italic tag left open
3176
3177 Normal text.
3178
3179 <!-- Unmatching number of opening, closing tags: -->
3180 '''This year''''s election ''should'' beat '''last year''''s.
3181
3182 ''Tom'''s car is bigger than ''Susan'''s.
3183
3184 Plain ''italic'''s plain
3185 !! result
3186 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3187 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3188 </p><p><b>Bold text..</b>
3189 </p><p>..spanning two paragraphs (should not work).<b></b>
3190 </p><p><b>Bold tag left open</b>
3191 </p><p><i>Italic tag left open</i>
3192 </p><p>Normal text.
3193 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3194 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3195 </p><p>Plain <i>italic'</i>s plain
3196 </p>
3197 !! end
3198
3199 ###
3200 ### Tables
3201 ###
3202 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3203 ###
3204
3205 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3206 # is the bare minimun required by the spec, see:
3207 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3208 !! test
3209 A table with no data. (php)
3210 !! options
3211 php
3212 !! input
3213 {||}
3214 !! result
3215 !! end
3216 # Parsoid team replies: empty table tags are legal in HTML5
3217 !! test
3218 A table with no data. (parsoid)
3219 !! options
3220 parsoid
3221 !! input
3222 {||}
3223 !! result
3224 <table></table>
3225 !! end
3226
3227 # A table with nothing but a caption is invalid XHTML, we might want to render
3228 # this as <p>caption</p>
3229 !! test
3230 A table with nothing but a caption (php)
3231 !! options
3232 php
3233 !! input
3234 {|
3235 |+ caption
3236 |}
3237 !! result
3238 <table>
3239 <caption> caption
3240 </caption><tr><td></td></tr></table>
3241
3242 !! end
3243 # Parsoid team replies: table with only a caption is legal in HTML5
3244 !! test
3245 A table with nothing but a caption (parsoid)
3246 !! options
3247 parsoid
3248 !! input
3249 {|
3250 |+ caption
3251 |}
3252 !! result
3253 <table><caption> caption</caption></table>
3254 !! end
3255
3256 !! test
3257 A table with caption with default-spaced attributes and a table row
3258 !! input
3259 {|
3260 |+ style="color: red;" | caption1
3261 |-
3262 | foo
3263 |}
3264 !! result
3265 <table>
3266 <caption style="color: red;"> caption1
3267 </caption>
3268 <tr>
3269 <td> foo
3270 </td></tr></table>
3271
3272 !! end
3273
3274 !! test
3275 A table with captions with non-default spaced attributes and a table row
3276 !! input
3277 {|
3278 |+style="color: red;"|caption2
3279 |+ style="color: red;"| caption3
3280 |-
3281 | foo
3282 |}
3283 !! result
3284 <table>
3285 <caption style="color: red;">caption2
3286 </caption>
3287 <caption style="color: red;"> caption3
3288 </caption>
3289 <tr>
3290 <td> foo
3291 </td></tr></table>
3292
3293 !! end
3294
3295 !! test
3296 Table td-cell syntax variations
3297 !! input
3298 {|
3299 | foo bar foo | baz
3300 | foo bar foo || baz
3301 | style='color:red;' | baz
3302 | style='color:red;' || baz
3303 |}
3304 !! result
3305 <table>
3306 <tr>
3307 <td> baz
3308 </td>
3309 <td> foo bar foo </td>
3310 <td> baz
3311 </td>
3312 <td style="color:red;"> baz
3313 </td>
3314 <td> style='color:red;' </td>
3315 <td> baz
3316 </td></tr></table>
3317
3318 !! end
3319
3320 !! test
3321 Simple table
3322 !! input
3323 {|
3324 | 1 || 2
3325 |-
3326 | 3 || 4
3327 |}
3328 !! result
3329 <table>
3330 <tr>
3331 <td> 1 </td>
3332 <td> 2
3333 </td></tr>
3334 <tr>
3335 <td> 3 </td>
3336 <td> 4
3337 </td></tr></table>
3338
3339 !! end
3340
3341 !! test
3342 Simple table but with multiple dashes for row wikitext
3343 !! input
3344 {|
3345 | foo
3346 |-----
3347 | bar
3348 |}
3349 !! result
3350 <table>
3351 <tr>
3352 <td> foo
3353 </td></tr>
3354 <tr>
3355 <td> bar
3356 </td></tr></table>
3357
3358 !! end
3359 !! test
3360 Multiplication table
3361 !! input
3362 {| border="1" cellpadding="2"
3363 |+Multiplication table
3364 |-
3365 ! &times; !! 1 !! 2 !! 3
3366 |-
3367 ! 1
3368 | 1 || 2 || 3
3369 |-
3370 ! 2
3371 | 2 || 4 || 6
3372 |-
3373 ! 3
3374 | 3 || 6 || 9
3375 |-
3376 ! 4
3377 | 4 || 8 || 12
3378 |-
3379 ! 5
3380 | 5 || 10 || 15
3381 |}
3382 !! result
3383 <table border="1" cellpadding="2">
3384 <caption>Multiplication table
3385 </caption>
3386 <tr>
3387 <th> &#215; </th>
3388 <th> 1 </th>
3389 <th> 2 </th>
3390 <th> 3
3391 </th></tr>
3392 <tr>
3393 <th> 1
3394 </th>
3395 <td> 1 </td>
3396 <td> 2 </td>
3397 <td> 3
3398 </td></tr>
3399 <tr>
3400 <th> 2
3401 </th>
3402 <td> 2 </td>
3403 <td> 4 </td>
3404 <td> 6
3405 </td></tr>
3406 <tr>
3407 <th> 3
3408 </th>
3409 <td> 3 </td>
3410 <td> 6 </td>
3411 <td> 9
3412 </td></tr>
3413 <tr>
3414 <th> 4
3415 </th>
3416 <td> 4 </td>
3417 <td> 8 </td>
3418 <td> 12
3419 </td></tr>
3420 <tr>
3421 <th> 5
3422 </th>
3423 <td> 5 </td>
3424 <td> 10 </td>
3425 <td> 15
3426 </td></tr></table>
3427
3428 !! end
3429
3430 !! test
3431 Accept "||" in table headings
3432 !! input
3433 {|
3434 !h1 || h2
3435 |}
3436 !! result
3437 <table>
3438 <tr>
3439 <th>h1 </th>
3440 <th> h2
3441 </th></tr></table>
3442
3443 !! end
3444
3445 !! test
3446 Accept "||" in indented table headings
3447 !! input
3448 :{|
3449 !h1 || h2
3450 |}
3451 !! result
3452 <dl><dd><table>
3453 <tr>
3454 <th>h1 </th>
3455 <th> h2
3456 </th></tr></table></dd></dl>
3457
3458 !! end
3459
3460 !! test
3461 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3462 !! input
3463 {|
3464 !| h1
3465 || a
3466 |}
3467 !! result
3468 <table>
3469 <tr>
3470 <th> h1
3471 </th>
3472 <td> a
3473 </td></tr></table>
3474
3475 !! end
3476
3477 !!test
3478 Accept "| !" at start of line in tables (ignore !-attribute)
3479 !!input
3480 {|
3481 |-
3482 | !style="color:red" | bar
3483 |}
3484 !!result
3485 <table>
3486
3487 <tr>
3488 <td> bar
3489 </td></tr></table>
3490
3491 !!end
3492
3493 !!test
3494 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3495 !!input
3496 {|
3497 |-
3498 |style='color:red;'|+1
3499 |style='color:blue;'|-1
3500 |-
3501 | 1 || 2 || 3
3502 | 1 ||+2 ||-3
3503 |-
3504 | +1
3505 | -1
3506 |}
3507 !!result
3508 <table>
3509
3510 <tr>
3511 <td style="color:red;">+1
3512 </td>
3513 <td style="color:blue;">-1
3514 </td></tr>
3515 <tr>
3516 <td> 1 </td>
3517 <td> 2 </td>
3518 <td> 3
3519 </td>
3520 <td> 1 </td>
3521 <td>+2 </td>
3522 <td>-3
3523 </td></tr>
3524 <tr>
3525 <td> +1
3526 </td>
3527 <td> -1
3528 </td></tr></table>
3529
3530 !!end
3531
3532 !! test
3533 Table rowspan
3534 !! input
3535 {| border=1
3536 | Cell 1, row 1
3537 |rowspan=2| Cell 2, row 1 (and 2)
3538 | Cell 3, row 1
3539 |-
3540 | Cell 1, row 2
3541 | Cell 3, row 2
3542 |}
3543 !! result
3544 <table border="1">
3545 <tr>
3546 <td> Cell 1, row 1
3547 </td>
3548 <td rowspan="2"> Cell 2, row 1 (and 2)
3549 </td>
3550 <td> Cell 3, row 1
3551 </td></tr>
3552 <tr>
3553 <td> Cell 1, row 2
3554 </td>
3555 <td> Cell 3, row 2
3556 </td></tr></table>
3557
3558 !! end
3559
3560 !! test
3561 Nested table
3562 !! input
3563 {| border=1
3564 | &alpha;
3565 |
3566 {| bgcolor=#ABCDEF border=2
3567 |nested
3568 |-
3569 |table
3570 |}
3571 |the original table again
3572 |}
3573 !! result
3574 <table border="1">
3575 <tr>
3576 <td> &#945;
3577 </td>
3578 <td>
3579 <table bgcolor="#ABCDEF" border="2">
3580 <tr>
3581 <td>nested
3582 </td></tr>
3583 <tr>
3584 <td>table
3585 </td></tr></table>
3586 </td>
3587 <td>the original table again
3588 </td></tr></table>
3589
3590 !! end
3591
3592 !! test
3593 Invalid attributes in table cell (bug 1830)
3594 !! input
3595 {|
3596 |Cell:|broken
3597 |}
3598 !! result
3599 <table>
3600 <tr>
3601 <td>broken
3602 </td></tr></table>
3603
3604 !! end
3605
3606
3607 !! test
3608 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3609 !! input
3610 {|
3611 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3612 !! result
3613 <table>
3614 <tr>
3615 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3616 <td>]" onmouseover="alert(document.cookie)"&gt;test
3617 </td>
3618 </tr>
3619 </table>
3620
3621 !! end
3622
3623
3624 !! test
3625 Indented table markup mixed with indented pre content (proposed in bug 6200)
3626 !! input
3627 <table>
3628 <tr>
3629 <td>
3630 Text that should be rendered preformatted
3631 </td>
3632 </tr>
3633 </table>
3634 !! result
3635 <table>
3636 <tr>
3637 <td>
3638 <pre>Text that should be rendered preformatted
3639 </pre>
3640 </td>
3641 </tr>
3642 </table>
3643
3644 !! end
3645
3646 !! test
3647 Template-generated table cell attributes and cell content
3648 !! input
3649 {|
3650 |{{table_attribs}}
3651 |}
3652 !! result
3653 <table>
3654 <tr>
3655 <td style="color: red"> Foo
3656 </td></tr></table>
3657
3658 !! end
3659
3660 !! test
3661 Table with row followed by newlines and table heading
3662 !! input
3663 {|
3664 |-
3665
3666 ! foo
3667 |}
3668 !! result
3669 <table>
3670
3671
3672 <tr>
3673 <th> foo
3674 </th></tr></table>
3675
3676 !! end
3677
3678 !! test
3679 Table with empty line following the start tag
3680 !! input
3681 {|
3682
3683 |-
3684 | foo
3685 |}
3686 !! result
3687 <table>
3688
3689
3690 <tr>
3691 <td> foo
3692 </td></tr></table>
3693
3694 !! end
3695
3696 # FIXME: Preserve the attribute properly (with an empty string as value) in
3697 # the PHP parser. Parsoid implements the behavior below.
3698 !! test
3699 Table attributes with empty value
3700 !! options
3701 parsoid
3702 !! input
3703 {|
3704 | style=| hello
3705 |}
3706 !! result
3707 <table>
3708 <tbody>
3709 <tr>
3710 <td style=""> hello
3711 </td></tr></tbody></table>
3712
3713 !! end
3714
3715 !! test
3716 Wikitext table with a lot of comments
3717 !! input
3718 {|
3719 <!-- c0 -->
3720 | foo
3721 <!-- c1 -->
3722 |- <!-- c2 -->
3723 <!-- c3 -->
3724 |<!-- c4 -->
3725 <!-- c5 -->
3726 |}
3727 !! result
3728 <table>
3729 <tr>
3730 <td> foo
3731 </td></tr>
3732 <tr>
3733 <td>
3734 </td></tr></table>
3735
3736 !! end
3737
3738 !! test
3739 Wikitext table with double-line table cell
3740 !! input
3741 {|
3742 |a
3743 b
3744 |}
3745 !! result
3746 <table>
3747 <tr>
3748 <td>a
3749 <p>b
3750 </p>
3751 </td></tr></table>
3752
3753 !! end
3754
3755 !! test
3756 Table cell with a single comment
3757 !! input
3758 {|
3759 | <!-- c1 -->
3760 | a
3761 |}
3762 !! result
3763 <table>
3764 <tr>
3765 <td>
3766 </td>
3767 <td> a
3768 </td></tr></table>
3769
3770 !! end
3771
3772 # The expected HTML structure in this test is debatable. The PHP parser does
3773 # not parse this kind of table at all. The main focus for Parsoid is on
3774 # round-tripping, so this output is ok for now. TODO: revisit!
3775 !! test
3776 Wikitext table with html-syntax row (Parsoid)
3777 !! options
3778 parsoid
3779 !! input
3780 {|
3781 |-
3782 <td>foo</td>
3783 |}
3784 !! result
3785 <table>
3786 <tbody>
3787 <tr>
3788 <td>foo</td></tr></tbody></table>
3789 !! end
3790
3791 ###
3792 ### Internal links
3793 ###
3794 !! test
3795 Plain link, capitalized
3796 !! input
3797 [[Main Page]]
3798 !! result
3799 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3800 </p>
3801 !! end
3802
3803 !! test
3804 Plain link, uncapitalized
3805 !! input
3806 [[main Page]]
3807 !! result
3808 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3809 </p>
3810 !! end
3811
3812 !! test
3813 Piped link
3814 !! input
3815 [[Main Page|The Main Page]]
3816 !! result
3817 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3818 </p>
3819 !! end
3820
3821 !! test
3822 Broken link
3823 !! input
3824 [[Zigzagzogzagzig]]
3825 !! result
3826 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3827 </p>
3828 !! end
3829
3830 !! test
3831 Broken link with fragment
3832 !! input
3833 [[Zigzagzogzagzig#zug]]
3834 !! result
3835 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3836 </p>
3837 !! end
3838
3839 !! test
3840 Special page link with fragment
3841 !! input
3842 [[Special:Version#anchor]]
3843 !! result
3844 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3845 </p>
3846 !! end
3847
3848 !! test
3849 Nonexistent special page link with fragment
3850 !! input
3851 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3852 !! result
3853 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3854 </p>
3855 !! end
3856
3857 !! test
3858 Link with prefix
3859 !! input
3860 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3861 !! result
3862 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3863 </p>
3864 !! end
3865
3866 !! test
3867 Link with suffix
3868 !! input
3869 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3870 !! result
3871 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3872 </p>
3873 !! end
3874
3875 !! article
3876 prefixed article
3877 !! text
3878 Some text
3879 !! endarticle
3880
3881 !! test
3882 Bug 43661: Piped links with identical prefixes
3883 !! input
3884 [[prefixed article|prefixed articles with spaces]]
3885
3886 [[prefixed article|prefixed articlesaoeu]]
3887
3888 [[Main Page|Main Page test]]
3889 !! result
3890 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3891 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3892 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3893 </p>
3894 !! end
3895
3896
3897 !! test
3898 Link with HTML entity in suffix / tail
3899 !! input
3900 [[Main Page]]&quot;, [[Main Page]]&#97;
3901 !! result
3902 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3903 </p>
3904 !! end
3905
3906 !! test
3907 Link with 3 brackets
3908 !! input
3909 [[[main page]]]
3910 !! result
3911 <p>[[[main page]]]
3912 </p>
3913 !! end
3914
3915 !! test
3916 Piped link with 3 brackets
3917 !! input
3918 [[[main page|the main page]]]
3919 !! result
3920 <p>[[[main page|the main page]]]
3921 </p>
3922 !! end
3923
3924 !! test
3925 Link with multiple pipes
3926 !! input
3927 [[Main Page|The|Main|Page]]
3928 !! result
3929 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3930 </p>
3931 !! end
3932
3933 !! test
3934 Link to namespaces
3935 !! input
3936 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3937 !! result
3938 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3939 </p>
3940 !! end
3941
3942 !! test
3943 Piped link to namespace
3944 !! input
3945 [[Meta:Disclaimers|The disclaimers]]
3946 !! result
3947 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3948 </p>
3949 !! end
3950
3951 !! test
3952 Link containing }
3953 !! input
3954 [[Usually caused by a typo (oops}]]
3955 !! result
3956 <p>[[Usually caused by a typo (oops}]]
3957 </p>
3958 !! end
3959
3960 !! test
3961 Link containing % (not as a hex sequence)
3962 !! input
3963 [[7% Solution]]
3964 !! result
3965 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3966 </p>
3967 !! end
3968
3969 !! test
3970 Link containing % as a single hex sequence interpreted to char
3971 !! input
3972 [[7%25 Solution]]
3973 !! result
3974 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3975 </p>
3976 !!end
3977
3978 !! test
3979 Link containing % as a double hex sequence interpreted to hex sequence
3980 !! input
3981 [[7%2525 Solution]]
3982 !! result
3983 <p>[[7%2525 Solution]]
3984 </p>
3985 !!end
3986
3987 !! test
3988 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3989 Example for such a section: == < ==
3990 !! input
3991 [[%23%3c]][[%23%3e]]
3992 !! result
3993 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3994 </p>
3995 !! end
3996
3997 !! test
3998 Link containing "<#" and ">#" as a hex sequences
3999 !! input
4000 [[%3c%23]][[%3e%23]]
4001 !! result
4002 <p>[[%3c%23]][[%3e%23]]
4003 </p>
4004 !! end
4005
4006 !! test
4007 Link containing an equals sign
4008 !! input
4009 [[Special:BookSources/isbn=4-00-026157-6]]
4010 !! result
4011 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
4012 </p>
4013 !! end
4014
4015 !! article
4016 Foo~bar
4017 !! text
4018 Just a test of an article title containing a tilde.
4019 !! endarticle
4020
4021 # note that links containing signatures, like [[Foo~~~~]], are
4022 # massaged by the pre-save transform (PST) and so the tildes are never
4023 # seen by the parser.
4024 !! test
4025 Link containing a tilde
4026 !! input
4027 [[Foo~bar]]
4028 !! result
4029 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
4030 </p>
4031 !! end
4032
4033 !! test
4034 Link containing double-single-quotes '' (bug 4598)
4035 !! input
4036 [[Lista d''e paise d''o munno]]
4037 !! result
4038 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4039 </p>
4040 !! end
4041
4042 !! test
4043 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4044 !! input
4045 Some [[Link|pretty ''italics'' and stuff]]!
4046 !! result
4047 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4048 </p>
4049 !! end
4050
4051 !! test
4052 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4053 !! input
4054 ''Some [[Link|pretty ''italics'' and stuff]]!
4055 !! result
4056 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4057 </p>
4058 !! end
4059
4060 !! test
4061 Link with double quotes in title part (literal) and alternate part (interpreted)
4062 !! input
4063 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4064
4065 [[''Pentecoste'']]
4066
4067 [[''Pentecoste''|Pentecoste]]
4068
4069 [[''Pentecoste''|''Pentecoste'']]
4070 !! result
4071 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4072 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4073 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4074 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4075 </p>
4076 !! end
4077
4078 !! test
4079 Broken image links with HTML captions (bug 39700)
4080 !! input
4081 [[File:Nonexistent|<script></script>]]
4082 [[File:Nonexistent|100px|<script></script>]]
4083 [[File:Nonexistent|&lt;]]
4084 [[File:Nonexistent|a<i>b</i>c]]
4085 !! result
4086 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4087 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4088 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4089 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4090 </p>
4091 !! end
4092
4093 !! test
4094 Plain link to URL
4095 !! input
4096 [[http://www.example.com]]
4097 !! result
4098 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4099 </p>
4100 !! end
4101
4102 !! test
4103 Plain link to URL with link text
4104 !! input
4105 [[http://www.example.com Link text]]
4106 !! result
4107 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4108 </p>
4109 !! end
4110
4111 !! test
4112 Plain link to protocol-relative URL
4113 !! input
4114 [[//www.example.com]]
4115 !! result
4116 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4117 </p>
4118 !! end
4119
4120 !! test
4121 Plain link to protocol-relative URL with link text
4122 !! input
4123 [[//www.example.com Link text]]
4124 !! result
4125 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4126 </p>
4127 !! end
4128
4129 !! test
4130 Plain link to page with question mark in title
4131 !! input
4132 [[A?b]]
4133
4134 [[A?b|Baz]]
4135 !! result
4136 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4137 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4138 </p>
4139 !! end
4140
4141
4142 # I'm fairly sure the expected result here is wrong.
4143 # We want these to be URL links, not pseudo-pages with URLs for titles....
4144 # However the current output is also pretty screwy.
4145 #
4146 # ----
4147 # I'm changing it to match the current output--it arguably makes more
4148 # sense in the light of the test above. Old expected result was:
4149 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4150 #</p>
4151 # But I think this test is bordering on "garbage in, garbage out" anyway.
4152 # -- wtm
4153 !! test
4154 Piped link to URL
4155 !! input
4156 Piped link to URL: [[http://www.example.com|an example URL]]
4157 !! result
4158 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4159 </p>
4160 !! end
4161
4162 !! test
4163 BUG 2: [[page|http://url/]] should link to page, not http://url/
4164 !! input
4165 [[Main Page|http://url/]]
4166 !! result
4167 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4168 </p>
4169 !! end
4170
4171 !! test
4172 BUG 337: Escaped self-links should be bold
4173 !! options
4174 title=[[Bug462]]
4175 !! input
4176 [[Bu&#103;462]] [[Bug462]]
4177 !! result
4178 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4179 </p>
4180 !! end
4181
4182 !! test
4183 Self-link to section should not be bold
4184 !! options
4185 title=[[Main Page]]
4186 !! input
4187 [[Main Page#section]]
4188 !! result
4189 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4190 </p>
4191 !! end
4192
4193 !! article
4194 00
4195 !! text
4196 This is 00.
4197 !! endarticle
4198
4199 !!test
4200 Self-link to numeric title
4201 !!options
4202 title=[[0]]
4203 !!input
4204 [[0]]
4205 !!result
4206 <p><strong class="selflink">0</strong>
4207 </p>
4208 !!end
4209
4210 !!test
4211 Link to numeric-equivalent title
4212 !!options
4213 title=[[0]]
4214 !!input
4215 [[00]]
4216 !!result
4217 <p><a href="/wiki/00" title="00">00</a>
4218 </p>
4219 !!end
4220
4221 !! test
4222 <nowiki> inside a link
4223 !! input
4224 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4225 !! result
4226 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4227 </p>
4228 !! end
4229
4230 !! test
4231 Non-breaking spaces in title
4232 !! input
4233 [[&nbsp; Main &nbsp; Page &nbsp;]]
4234 !! result
4235 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4236 </p>
4237 !!end
4238
4239 !! test
4240 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4241 !! options
4242 language=ca
4243 !! input
4244 '''[[Main Page]]'''
4245 !! result
4246 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4247 </p>
4248 !! end
4249
4250 !! test
4251 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4252 !! options
4253 language=ca
4254 !! input
4255 ''[[Main Page]]''
4256 !! result
4257 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4258 </p>
4259 !! end
4260
4261 !! test
4262 Internal link with en linktrail: no apostrophes (bug 27473)
4263 !! options
4264 language=en
4265 !! input
4266 [[Something]]'nice
4267 !! result
4268 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4269 </p>
4270 !! end
4271
4272 !! test
4273 Internal link with ca linktrail with apostrophes (bug 27473)
4274 !! options
4275 language=ca
4276 !! input
4277 [[Something]]'nice
4278 !! result
4279 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4280 </p>
4281 !! end
4282
4283 !! test
4284 Internal link with kaa linktrail with apostrophes (bug 27473)
4285 !! options
4286 language=kaa
4287 !! input
4288 [[Something]]'nice
4289 !! result
4290 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4291 </p>
4292 !! end
4293
4294 !! article
4295 Söfnuður
4296 !! text
4297 Test.
4298 !! endarticle
4299
4300 !! test
4301 Internal link with is link prefix
4302 !! options
4303 language=is
4304 !! input
4305 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4306 !! result
4307 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4308 </p>
4309 !! end
4310
4311 !! article
4312 Mótmælendatrú
4313 !! text
4314 Test.
4315 !! endarticle
4316
4317 !! test
4318 Internal link with is link trail and link prefix
4319 !! options
4320 language=is
4321 !! input
4322 [[mótmælendatrú|xxx]]ar
4323 [[mótmælendatrú]]ar
4324 mótmælenda[[söfnuður]]
4325 mótmælenda[[söfnuður|söfnuðir]]
4326 mótmælenda[[söfnuður|söfnuðir]]xxx
4327 !! result
4328 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4329 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4330 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4331 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4332 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4333 </p>
4334 !! end
4335
4336 !! test
4337 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4338 !! input
4339 [[Foo| bar]]
4340
4341 [[Foo| ''bar'']]
4342
4343 [http://wp.org foo]
4344
4345 [http://wp.org ''foo'']
4346 !! result
4347 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4348 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4349 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4350 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4351 </p>
4352 !! end
4353
4354 ###
4355 ### Interwiki links (see maintenance/interwiki.sql)
4356 ###
4357
4358 !! test
4359 Inline interwiki link
4360 !! input
4361 [[MeatBall:SoftSecurity]]
4362 !! result
4363 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4364 </p>
4365 !! end
4366
4367 !! test
4368 Inline interwiki link with empty title (bug 2372)
4369 !! input
4370 [[MeatBall:]]
4371 !! result
4372 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4373 </p>
4374 !! end
4375
4376 !! test
4377 Interwiki link encoding conversion (bug 1636)
4378 !! input
4379 *[[Wikipedia:ro:Olteni&#0355;a]]
4380 *[[Wikipedia:ro:Olteni&#355;a]]
4381 !! result
4382 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4383 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4384 </li></ul>
4385
4386 !! end
4387
4388 !! test
4389 Interwiki link with fragment (bug 2130)
4390 !! input
4391 [[MeatBall:SoftSecurity#foo]]
4392 !! result
4393 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4394 </p>
4395 !! end
4396
4397 !! test
4398 Interlanguage link
4399 !! input
4400 Blah blah blah
4401 [[zh:Chinese]]
4402 !!result
4403 <p>Blah blah blah
4404 </p>
4405 !! end
4406
4407 !! test
4408 Double interlanguage link
4409 !! input
4410 Blah blah blah
4411 [[es:Spanish]]
4412 [[zh:Chinese]]
4413 !!result
4414 <p>Blah blah blah
4415 </p>
4416 !! end
4417
4418 !! test
4419 Interlanguage link, with prefix links
4420 !! options
4421 language=ln
4422 !! input
4423 Blah blah blah
4424 [[zh:Chinese]]
4425 !!result
4426 <p>Blah blah blah
4427 </p>
4428 !! end
4429
4430 !! test
4431 Double interlanguage link, with prefix links (bug 8897)
4432 !! options
4433 language=ln
4434 !! input
4435 Blah blah blah
4436 [[es:Spanish]]
4437 [[zh:Chinese]]
4438 !!result
4439 <p>Blah blah blah
4440 </p>
4441 !! end
4442
4443 !! test
4444 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4445 !! options
4446 language=ln
4447 !! input
4448 [[WW&nbsp;II]]
4449 !!result
4450 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4451 </p>
4452 !! end
4453
4454 ##
4455 ## XHTML tidiness
4456 ###
4457
4458 !! test
4459 <br> to <br />
4460 !! input
4461 1<br>2<br />3
4462 !! result
4463 <p>1<br />2<br />3
4464 </p>
4465 !! end
4466
4467 !! test
4468 Broken br tag sanitization
4469 !! input
4470 </br>
4471 !! result
4472 <p>&lt;/br&gt;
4473 </p>
4474 !! end
4475
4476 !! test
4477 Incorrecly removing closing slashes from correctly formed XHTML
4478 !! input
4479 <br style="clear:both;" />
4480 !! result
4481 <p><br style="clear:both;" />
4482 </p>
4483 !! end
4484
4485 !! test
4486 Failing to transform badly formed HTML into correct XHTML
4487 !! input
4488 <br style="clear: left;">
4489 <br style="clear: right;">
4490 <br style="clear: both;">
4491 !! result
4492 <p><br style="clear: left;" />
4493 <br style="clear: right;" />
4494 <br style="clear: both;" />
4495 </p>
4496 !!end
4497
4498 !! test
4499 Handling html with a div self-closing tag
4500 !! input
4501 <div title />
4502 <div title/>
4503 <div title/ >
4504 <div title=bar />
4505 <div title=bar/>
4506 <div title=bar/ >
4507 !! result
4508 <p>&lt;div title /&gt;
4509 &lt;div title/&gt;
4510 </p>
4511 <div>
4512 <p>&lt;div title=bar /&gt;
4513 &lt;div title=bar/&gt;
4514 </p>
4515 <div title="bar/"></div>
4516 </div>
4517
4518 !! end
4519
4520 !! test
4521 Handling html with a br self-closing tag
4522 !! input
4523 <br title />
4524 <br title/>
4525 <br title/ >
4526 <br title=bar />
4527 <br title=bar/>
4528 <br title=bar/ >
4529 !! result
4530 <p><br title="title" />
4531 <br title="title" />
4532 <br />
4533 <br title="bar" />
4534 <br title="bar" />
4535 <br title="bar/" />
4536 </p>
4537 !! end
4538
4539 !! test
4540 Horizontal ruler (should it add that extra space?)
4541 !! input
4542 <hr>
4543 <hr >
4544 foo <hr
4545 > bar
4546 !! result
4547 <hr />
4548 <hr />
4549 foo <hr /> bar
4550
4551 !! end
4552
4553 !! test
4554 Horizontal ruler -- 4+ dashes render hr
4555 !! input
4556 ----
4557 !! result
4558 <hr />
4559
4560 !! end
4561
4562 !! test
4563 Horizontal ruler -- eats additional dashes on the same line
4564 !! input
4565 ---------
4566 !! result
4567 <hr />
4568
4569 !! end
4570
4571 !! test
4572 Horizontal ruler -- does not collapse dashes on consecutive lines
4573 !! input
4574 ----
4575 ----
4576 !! result
4577 <hr />
4578 <hr />
4579
4580 !! end
4581
4582 !! test
4583 Horizontal ruler -- <4 dashes render as plain text
4584 !! input
4585 ---
4586 !! result
4587 <p>---
4588 </p>
4589 !! end
4590
4591 !! test
4592 Horizontal ruler -- Supports content following dashes on same line
4593 !! input
4594 ---- Foo
4595 !! result
4596 <hr /> Foo
4597
4598 !! end
4599
4600 ###
4601 ### Block-level elements
4602 ###
4603 !! test
4604 Common list
4605 !! input
4606 *Common list
4607 * item 2
4608 *item 3
4609 !! result
4610 <ul><li>Common list
4611 </li><li> item 2
4612 </li><li>item 3
4613 </li></ul>
4614
4615 !! end
4616
4617 !! test
4618 Numbered list
4619 !! input
4620 #Numbered list
4621 #item 2
4622 # item 3
4623 !! result
4624 <ol><li>Numbered list
4625 </li><li>item 2
4626 </li><li> item 3
4627 </li></ol>
4628
4629 !! end
4630
4631 !! test
4632 Mixed list
4633 !! input
4634 *Mixed list
4635 *# with numbers
4636 ** and bullets
4637 *# and numbers
4638 *bullets again
4639 **bullet level 2
4640 ***bullet level 3
4641 ***#Number on level 4
4642 **bullet level 2
4643 **#Number on level 3
4644 **#Number on level 3
4645 *#number level 2
4646 *Level 1
4647 *** Level 3
4648 #** Level 3, but ordered
4649 !! result
4650 <ul><li>Mixed list
4651 <ol><li> with numbers
4652 </li></ol>
4653 <ul><li> and bullets
4654 </li></ul>
4655 <ol><li> and numbers
4656 </li></ol>
4657 </li><li>bullets again
4658 <ul><li>bullet level 2
4659 <ul><li>bullet level 3
4660 <ol><li>Number on level 4
4661 </li></ol>
4662 </li></ul>
4663 </li><li>bullet level 2
4664 <ol><li>Number on level 3
4665 </li><li>Number on level 3
4666 </li></ol>
4667 </li></ul>
4668 <ol><li>number level 2
4669 </li></ol>
4670 </li><li>Level 1
4671 <ul><li><ul><li> Level 3
4672 </li></ul>
4673 </li></ul>
4674 </li></ul>
4675 <ol><li><ul><li><ul><li> Level 3, but ordered
4676 </li></ul>
4677 </li></ul>
4678 </li></ol>
4679
4680 !! end
4681
4682 !! test
4683 Nested lists 1
4684 !! input
4685 *foo
4686 **bar
4687 !! result
4688 <ul><li>foo
4689 <ul><li>bar
4690 </li></ul>
4691 </li></ul>
4692
4693 !! end
4694
4695 !! test
4696 Nested lists 2
4697 !! input
4698 **foo
4699 *bar
4700 !! result
4701 <ul><li><ul><li>foo
4702 </li></ul>
4703 </li><li>bar
4704 </li></ul>
4705
4706 !! end
4707
4708 !! test
4709 Nested lists 3 (first element empty)
4710 !! input
4711 *
4712 **bar
4713 !! result
4714 <ul><li>
4715 <ul><li>bar
4716 </li></ul>
4717 </li></ul>
4718
4719 !! end
4720
4721 !! test
4722 Nested lists 4 (first element empty)
4723 !! input
4724 **
4725 *bar
4726 !! result
4727 <ul><li><ul><li>
4728 </li></ul>
4729 </li><li>bar
4730 </li></ul>
4731
4732 !! end
4733
4734 !! test
4735 Nested lists 5 (both elements empty)
4736 !! input
4737 **
4738 *
4739 !! result
4740 <ul><li><ul><li>
4741 </li></ul>
4742 </li><li>
4743 </li></ul>
4744
4745 !! end
4746
4747 !! test
4748 Nested lists 6 (both elements empty)
4749 !! input
4750 *
4751 **
4752 !! result
4753 <ul><li>
4754 <ul><li>
4755 </li></ul>
4756 </li></ul>
4757
4758 !! end
4759
4760 !! test
4761 Nested lists 7 (skip initial nesting levels)
4762 !! input
4763 *** foo
4764 !! result
4765 <ul><li><ul><li><ul><li> foo
4766 </li></ul>
4767 </li></ul>
4768 </li></ul>
4769
4770 !! end
4771
4772 !! test
4773 Nested lists 8 (multiple nesting transitions)
4774 !! input
4775 * foo
4776 *** bar
4777 ** baz
4778 * boo
4779 !! result
4780 <ul><li> foo
4781 <ul><li><ul><li> bar
4782 </li></ul>
4783 </li><li> baz
4784 </li></ul>
4785 </li><li> boo
4786 </li></ul>
4787
4788 !! end
4789
4790 !! test
4791 1. Lists with start-of-line-transparent tokens before bullets: Comments
4792 !! input
4793 *foo
4794 *<!--cmt-->bar
4795 <!--cmt-->*baz
4796 !! result
4797 <ul><li>foo
4798 </li><li>bar
4799 </li><li>baz
4800 </li></ul>
4801
4802 !! end
4803
4804 !! test
4805 2. Lists with start-of-line-transparent tokens before bullets: Template close
4806 !! input
4807 *foo {{echo|bar
4808 }}*baz
4809 !! result
4810 <ul><li>foo bar
4811 </li><li>baz
4812 </li></ul>
4813
4814 !! end
4815
4816 !! test
4817 Unbalanced closing block tags break a list
4818 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4819 !! options
4820 parsoid
4821 !! input
4822 <div>
4823 *a</div><div>
4824 *b</div>
4825 !! result
4826 <div>
4827 <ul><li>a
4828 </li></ul></div><div>
4829 <ul><li>b
4830 </li></ul></div>
4831 !! end
4832
4833 !! test
4834 Unbalanced closing non-block tags don't break a list
4835 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4836 !! options
4837 parsoid
4838 !! input
4839 <span>
4840 *a</span><span>
4841 *b</span>
4842 !! result
4843 <p><span></span>
4844 </p>
4845 <ul><li>a<span></span>
4846 </li><li>b
4847 </li></ul>
4848 !! end
4849
4850 !! test
4851 Unclosed formatting tags that straddle lists are closed and reopened
4852 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4853 !! options
4854 parsoid
4855 !! input
4856 # <s> a
4857 # b </s>
4858 !! result
4859 <ol><li> <s> a </s>
4860 </li><li> <s> b </s>
4861 </li></ol>
4862 !! end
4863
4864 !!test
4865 List embedded in a non-block tag
4866 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4867 !! options
4868 parsoid
4869 !!input
4870 <small>
4871 * foo
4872 </small>
4873 !!result
4874 <p><small></small></p>
4875 <small>
4876 <ul>
4877 <li> foo</li>
4878 </ul>
4879 </small>
4880 <p><small></small></p>
4881 !!end
4882
4883 !! test
4884 List items are not parsed correctly following a <pre> block (bug 785)
4885 !! input
4886 * <pre>foo</pre>
4887 * <pre>bar</pre>
4888 * zar
4889 !! result
4890 <ul><li> <pre>foo</pre>
4891 </li><li> <pre>bar</pre>
4892 </li><li> zar
4893 </li></ul>
4894
4895 !! end
4896
4897 !! test
4898 List items from template
4899 !! input
4900
4901 {{inner list}}
4902 * item 2
4903
4904 * item 0
4905 {{inner list}}
4906 * item 2
4907
4908 * item 0
4909 * notSOL{{inner list}}
4910 * item 2
4911 !! result
4912 <ul><li> item 1
4913 </li><li> item 2
4914 </li></ul>
4915 <ul><li> item 0
4916 </li><li> item 1
4917 </li><li> item 2
4918 </li></ul>
4919 <ul><li> item 0
4920 </li><li> notSOL
4921 </li><li> item 1
4922 </li><li> item 2
4923 </li></ul>
4924
4925 !! end
4926
4927 !! test
4928 List interrupted by empty line or heading
4929 !! input
4930 * foo
4931
4932 ** bar
4933 == A heading ==
4934 * Another list item
4935 !! result
4936 <ul><li> foo
4937 </li></ul>
4938 <ul><li><ul><li> bar
4939 </li></ul>
4940 </li></ul>
4941 <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4942 <ul><li> Another list item
4943 </li></ul>
4944
4945 !!end
4946
4947 !!test
4948 Multiple list tags generated by templates
4949 !!input
4950 {{echo|<li>}}a
4951 {{echo|<li>}}b
4952 {{echo|<li>}}c
4953 !!result
4954 <li>a
4955 <li>b
4956 <li>c</li>
4957 </li>
4958 </li>
4959
4960 !!end
4961
4962 !!test
4963 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4964 !!input
4965 *a
4966 <!--This line will NOT split the list-->
4967 *b
4968 <!--This line will NOT split the list either-->
4969 *c
4970 <!--foo--> <!--This line with more than 1 comment will split the list-->
4971 *d
4972 !!result
4973 <ul><li>a
4974 </li><li>b
4975 </li><li>c
4976 </li></ul>
4977 <ul><li>d
4978 </li></ul>
4979
4980 !!end
4981
4982 ###
4983 ### Magic Words
4984 ###
4985
4986 !! test
4987 Magic Word: {{CURRENTDAY}}
4988 !! input
4989 {{CURRENTDAY}}
4990 !! result
4991 <p>1
4992 </p>
4993 !! end
4994
4995 !! test
4996 Magic Word: {{CURRENTDAY2}}
4997 !! input
4998 {{CURRENTDAY2}}
4999 !! result
5000 <p>01
5001 </p>
5002 !! end
5003
5004 !! test
5005 Magic Word: {{CURRENTDAYNAME}}
5006 !! input
5007 {{CURRENTDAYNAME}}
5008 !! result
5009 <p>Thursday
5010 </p>
5011 !! end
5012
5013 !! test
5014 Magic Word: {{CURRENTDOW}}
5015 !! input
5016 {{CURRENTDOW}}
5017 !! result
5018 <p>4
5019 </p>
5020 !! end
5021
5022 !! test
5023 Magic Word: {{CURRENTMONTH}}
5024 !! input
5025 {{CURRENTMONTH}}
5026 !! result
5027 <p>01
5028 </p>
5029 !! end
5030
5031 !! test
5032 Magic Word: {{CURRENTMONTHABBREV}}
5033 !! input
5034 {{CURRENTMONTHABBREV}}
5035 !! result
5036 <p>Jan
5037 </p>
5038 !! end
5039
5040 !! test
5041 Magic Word: {{CURRENTMONTHNAME}}
5042 !! input
5043 {{CURRENTMONTHNAME}}
5044 !! result
5045 <p>January
5046 </p>
5047 !! end
5048
5049 !! test
5050 Magic Word: {{CURRENTMONTHNAMEGEN}}
5051 !! input
5052 {{CURRENTMONTHNAMEGEN}}
5053 !! result
5054 <p>January
5055 </p>
5056 !! end
5057
5058 !! test
5059 Magic Word: {{CURRENTTIME}}
5060 !! input
5061 {{CURRENTTIME}}
5062 !! result
5063 <p>00:02
5064 </p>
5065 !! end
5066
5067 !! test
5068 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5069 !! input
5070 {{CURRENTWEEK}}
5071 !! result
5072 <p>1
5073 </p>
5074 !! end
5075
5076 !! test
5077 Magic Word: {{CURRENTYEAR}}
5078 !! input
5079 {{CURRENTYEAR}}
5080 !! result
5081 <p>1970
5082 </p>
5083 !! end
5084
5085 !! test
5086 Magic Word: {{FULLPAGENAME}}
5087 !! options
5088 title=[[User:Ævar Arnfjörð Bjarmason]]
5089 !! input
5090 {{FULLPAGENAME}}
5091 !! result
5092 <p>User:Ævar Arnfjörð Bjarmason
5093 </p>
5094 !! end
5095
5096 !! test
5097 Magic Word: {{FULLPAGENAMEE}}
5098 !! options
5099 title=[[User:Ævar Arnfjörð Bjarmason]]
5100 !! input
5101 {{FULLPAGENAMEE}}
5102 !! result
5103 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5104 </p>
5105 !! end
5106
5107 !! test
5108 Magic Word: {{NAMESPACE}}
5109 !! options
5110 title=[[User:Ævar Arnfjörð Bjarmason]]
5111 !! input
5112 {{NAMESPACE}}
5113 !! result
5114 <p>User
5115 </p>
5116 !! end
5117
5118 !! test
5119 Magic Word: {{NAMESPACEE}}
5120 !! options
5121 title=[[User:Ævar Arnfjörð Bjarmason]]
5122 !! input
5123 {{NAMESPACEE}}
5124 !! result
5125 <p>User
5126 </p>
5127 !! end
5128
5129 !! test
5130 Magic Word: {{NAMESPACENUMBER}}
5131 !! options
5132 title=[[User:Ævar Arnfjörð Bjarmason]]
5133 !! input
5134 {{NAMESPACENUMBER}}
5135 !! result
5136 <p>2
5137 </p>
5138 !! end
5139
5140 !! test
5141 Magic Word: {{NUMBEROFFILES}}
5142 !! input
5143 {{NUMBEROFFILES}}
5144 !! result
5145 <p>3
5146 </p>
5147 !! end
5148
5149 !! test
5150 Magic Word: {{PAGENAME}}
5151 !! options
5152 title=[[User:Ævar Arnfjörð Bjarmason]]
5153 !! input
5154 {{PAGENAME}}
5155 !! result
5156 <p>Ævar Arnfjörð Bjarmason
5157 </p>
5158 !! end
5159
5160 !! test
5161 Magic Word: {{PAGENAME}} with metacharacters
5162 !! options
5163 title=[['foo & bar = baz']]
5164 !! input
5165 ''{{PAGENAME}}''
5166 !! result
5167 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5168 </p>
5169 !! end
5170
5171 !! test
5172 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5173 !! options
5174 title=[[*RFC 1234 http://example.com/]]
5175 !! input
5176 {{PAGENAME}}
5177 !! result
5178 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5179 </p>
5180 !! end
5181
5182 !! test
5183 Magic Word: {{PAGENAMEE}}
5184 !! options
5185 title=[[User:Ævar Arnfjörð Bjarmason]]
5186 !! input
5187 {{PAGENAMEE}}
5188 !! result
5189 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5190 </p>
5191 !! end
5192
5193 !! test
5194 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5195 !! options
5196 title=[[*RFC 1234 http://example.com/]]
5197 !! input
5198 {{PAGENAMEE}}
5199 !! result
5200 <p>&#42;RFC_1234_http&#58;//example.com/
5201 </p>
5202 !! end
5203
5204 !! test
5205 Magic Word: {{REVISIONID}}
5206 !! input
5207 {{REVISIONID}}
5208 !! result
5209 <p>1337
5210 </p>
5211 !! end
5212
5213 !! test
5214 Magic Word: {{SCRIPTPATH}}
5215 !! input
5216 {{SCRIPTPATH}}
5217 !! result
5218 <p>/
5219 </p>
5220 !! end
5221
5222 !! test
5223 Magic Word: {{SERVER}}
5224 !! input
5225 {{SERVER}}
5226 !! result
5227 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5228 </p>
5229 !! end
5230
5231 !! test
5232 Magic Word: {{SERVERNAME}}
5233 !! input
5234 {{SERVERNAME}}
5235 !! result
5236 <p>example.org
5237 </p>
5238 !! end
5239
5240 !! test
5241 Magic Word: {{SITENAME}}
5242 !! input
5243 {{SITENAME}}
5244 !! result
5245 <p>MediaWiki
5246 </p>
5247 !! end
5248
5249 !! test
5250 Case-sensitive magic words, when cased differently, should just be template transclusions
5251 !! input
5252 {{CurrentMonth}}
5253 {{currentday}}
5254 {{cURreNTweEK}}
5255 {{currentHour}}
5256 !! result
5257 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5258 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5259 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5260 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5261 </p>
5262 !! end
5263
5264 !! test
5265 Case-insensitive magic words should still work with weird casing.
5266 !! input
5267 {{sErVeRNaMe}}
5268 {{LCFirst:AOEU}}
5269 {{ucFIRST:aoeu}}
5270 {{SERver}}
5271 !! result
5272 <p>example.org
5273 aOEU
5274 Aoeu
5275 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5276 </p>
5277 !! end
5278
5279 !! test
5280 Namespace 1 {{ns:1}}
5281 !! input
5282 {{ns:1}}
5283 !! result
5284 <p>Talk
5285 </p>
5286 !! end
5287
5288 !! test
5289 Namespace 1 {{ns:01}}
5290 !! input
5291 {{ns:01}}
5292 !! result
5293 <p>Talk
5294 </p>
5295 !! end
5296
5297 !! test
5298 Namespace 0 {{ns:0}} (bug 4783)
5299 !! input
5300 {{ns:0}}
5301 !! result
5302
5303 !! end
5304
5305 !! test
5306 Namespace 0 {{ns:00}} (bug 4783)
5307 !! input
5308 {{ns:00}}
5309 !! result
5310
5311 !! end
5312
5313 !! test
5314 Namespace -1 {{ns:-1}}
5315 !! input
5316 {{ns:-1}}
5317 !! result
5318 <p>Special
5319 </p>
5320 !! end
5321
5322 !! test
5323 Namespace User {{ns:User}}
5324 !! input
5325 {{ns:User}}
5326 !! result
5327 <p>User
5328 </p>
5329 !! end
5330
5331 !! test
5332 Namespace User talk {{ns:User_talk}}
5333 !! input
5334 {{ns:User_talk}}
5335 !! result
5336 <p>User talk
5337 </p>
5338 !! end
5339
5340 !! test
5341 Namespace User talk {{ns:uSeR tAlK}}
5342 !! input
5343 {{ns:uSeR tAlK}}
5344 !! result
5345 <p>User talk
5346 </p>
5347 !! end
5348
5349 !! test
5350 Namespace File {{ns:File}}
5351 !! input
5352 {{ns:File}}
5353 !! result
5354 <p>File
5355 </p>
5356 !! end
5357
5358 !! test
5359 Namespace File {{ns:Image}}
5360 !! input
5361 {{ns:Image}}
5362 !! result
5363 <p>File
5364 </p>
5365 !! end
5366
5367 !! test
5368 Namespace (lang=de) Benutzer {{ns:User}}
5369 !! options
5370 language=de
5371 !! input
5372 {{ns:User}}
5373 !! result
5374 <p>Benutzer
5375 </p>
5376 !! end
5377
5378 !! test
5379 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5380 !! options
5381 language=de
5382 !! input
5383 {{ns:3}}
5384 !! result
5385 <p>Benutzer Diskussion
5386 </p>
5387 !! end
5388
5389
5390 !! test
5391 Urlencode
5392 !! input
5393 {{urlencode:hi world?!}}
5394 {{urlencode:hi world?!|WIKI}}
5395 {{urlencode:hi world?!|PATH}}
5396 {{urlencode:hi world?!|QUERY}}
5397 !! result
5398 <p>hi+world%3F%21
5399 hi_world%3F!
5400 hi%20world%3F%21
5401 hi+world%3F%21
5402 </p>
5403 !! end
5404
5405 ###
5406 ### Magic links
5407 ###
5408 !! test
5409 Magic links: internal link to RFC (bug 479)
5410 !! input
5411 [[RFC 123]]
5412 !! result
5413 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5414 </p>
5415 !! end
5416
5417 !! test
5418 Magic links: RFC (bug 479)
5419 !! input
5420 RFC 822
5421 !! result
5422 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5423 </p>
5424 !! end
5425
5426 !! test
5427 Magic links: ISBN (bug 1937)
5428 !! input
5429 ISBN 0-306-40615-2
5430 !! result
5431 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5432 </p>
5433 !! end
5434
5435 !! test
5436 Magic links: PMID incorrectly converts space to underscore
5437 !! input
5438 PMID 1234
5439 !! result
5440 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5441 </p>
5442 !! end
5443
5444 ###
5445 ### Templates
5446 ####
5447
5448 !! test
5449 Nonexistent template
5450 !! input
5451 {{thistemplatedoesnotexist}}
5452 !! result
5453 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5454 </p>
5455 !! end
5456
5457 !! test
5458 Template with invalid target containing tags
5459 !! input
5460 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5461 !! result
5462 <p>{{a<b>b</b>|foo|a=b|a = b}}
5463 </p>
5464 !! end
5465
5466 !! test
5467 Template with invalid target containing unclosed tag
5468 !! input
5469 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5470 !! result
5471 <p>{{a<b>|foo|a=b|a = b}}</b>
5472 </p>
5473 !! end
5474
5475 !! article
5476 Template:test
5477 !! text
5478 This is a test template
5479 !! endarticle
5480
5481 !! test
5482 Simple template
5483 !! input
5484 {{test}}
5485 !! result
5486 <p>This is a test template
5487 </p>
5488 !! end
5489
5490 !! test
5491 Template with explicit namespace
5492 !! input
5493 {{Template:test}}
5494 !! result
5495 <p>This is a test template
5496 </p>
5497 !! end
5498
5499
5500 !! article
5501 Template:paramtest
5502 !! text
5503 This is a test template with parameter {{{param}}}
5504 !! endarticle
5505
5506 !! test
5507 Template parameter
5508 !! input
5509 {{paramtest|param=foo}}
5510 !! result
5511 <p>This is a test template with parameter foo
5512 </p>
5513 !! end
5514
5515 !! article
5516 Template:paramtestnum
5517 !! text
5518 [[{{{1}}}|{{{2}}}]]
5519 !! endarticle
5520
5521 !! test
5522 Template unnamed parameter
5523 !! input
5524 {{paramtestnum|Main Page|the main page}}
5525 !! result
5526 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5527 </p>
5528 !! end
5529
5530 !! article
5531 Template:templatesimple
5532 !! text
5533 (test)
5534 !! endarticle
5535
5536 !! article
5537 Template:templateredirect
5538 !! text
5539 #redirect [[Template:templatesimple]]
5540 !! endarticle
5541
5542 !! article
5543 Template:templateasargtestnum
5544 !! text
5545 {{{{{1}}}}}
5546 !! endarticle
5547
5548 !! article
5549 Template:templateasargtest
5550 !! text
5551 {{template{{{templ}}}}}
5552 !! endarticle
5553
5554 !! article
5555 Template:templateasargtest2
5556 !! text
5557 {{{{{templ}}}}}
5558 !! endarticle
5559
5560 !! test
5561 Template with template name as unnamed argument
5562 !! input
5563 {{templateasargtestnum|templatesimple}}
5564 !! result
5565 <p>(test)
5566 </p>
5567 !! end
5568
5569 !! test
5570 Template with template name as argument
5571 !! input
5572 {{templateasargtest|templ=simple}}
5573 !! result
5574 <p>(test)
5575 </p>
5576 !! end
5577
5578 !! test
5579 Template with template name as argument (2)
5580 !! input
5581 {{templateasargtest2|templ=templatesimple}}
5582 !! result
5583 <p>(test)
5584 </p>
5585 !! end
5586
5587 !! article
5588 Template:templateasargtestdefault
5589 !! text
5590 {{{{{templ|templatesimple}}}}}
5591 !! endarticle
5592
5593 !! article
5594 Template:templa
5595 !! text
5596 '''templ'''
5597 !! endarticle
5598
5599 !! test
5600 Template with default value
5601 !! input
5602 {{templateasargtestdefault}}
5603 !! result
5604 <p>(test)
5605 </p>
5606 !! end
5607
5608 !! test
5609 Template with default value (value set)
5610 !! input
5611 {{templateasargtestdefault|templ=templa}}
5612 !! result
5613 <p><b>templ</b>
5614 </p>
5615 !! end
5616
5617 !! test
5618 Template redirect
5619 !! input
5620 {{templateredirect}}
5621 !! result
5622 <p>(test)
5623 </p>
5624 !! end
5625
5626 !! test
5627 Template with argument in separate line
5628 !! input
5629 {{ templateasargtest |
5630 templ = simple }}
5631 !! result
5632 <p>(test)
5633 </p>
5634 !! end
5635
5636 !! test
5637 Template with complex template as argument
5638 !! input
5639 {{paramtest|
5640 param ={{ templateasargtest |
5641 templ = simple }}}}
5642 !! result
5643 <p>This is a test template with parameter (test)
5644 </p>
5645 !! end
5646
5647 !! test
5648 Template with thumb image (with link in description)
5649 !! input
5650 {{paramtest|
5651 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5652 !! result
5653 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5654
5655 !! end
5656
5657 !! article
5658 Template:complextemplate
5659 !! text
5660 {{{1}}} {{paramtest|
5661 param ={{{param}}}}}
5662 !! endarticle
5663
5664 !! test
5665 Template with complex arguments
5666 !! input
5667 {{complextemplate|
5668 param ={{ templateasargtest |
5669 templ = simple }}|[[Template:complextemplate|link]]}}
5670 !! result
5671 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5672 </p>
5673 !! end
5674
5675 !! test
5676 BUG 553: link with two variables in a piped link
5677 !! input
5678 {|
5679 |[[{{{1}}}|{{{2}}}]]
5680 |}
5681 !! result
5682 <table>
5683 <tr>
5684 <td>[[{{{1}}}|{{{2}}}]]
5685 </td></tr></table>
5686
5687 !! end
5688
5689 !! test
5690 Magic variable as template parameter
5691 !! input
5692 {{paramtest|param={{SITENAME}}}}
5693 !! result
5694 <p>This is a test template with parameter MediaWiki
5695 </p>
5696 !! end
5697
5698 !! article
5699 Template:linktest
5700 !! text
5701 [[{{{param}}}|link]]
5702 !! endarticle
5703
5704 !! test
5705 Template parameter as link source
5706 !! input
5707 {{linktest|param=Main Page}}
5708 !! result
5709 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5710 </p>
5711 !! end
5712
5713 !!test
5714 Template-generated attribute string (k='v')
5715 !!input
5716 <span {{attr_str|id|v1}}>bar</span>
5717 !!result
5718 <p><span id="v1">bar</span>
5719 </p>
5720 !!end
5721
5722 !!article
5723 Template:paramtest2
5724 !! text
5725 including another template, {{paramtest|param={{{arg}}}}}
5726 !! endarticle
5727
5728 !! test
5729 Template passing argument to another template
5730 !! input
5731 {{paramtest2|arg='hmm'}}
5732 !! result
5733 <p>including another template, This is a test template with parameter 'hmm'
5734 </p>
5735 !! end
5736
5737 !! article
5738 Template:Linktest2
5739 !! text
5740 Main Page
5741 !! endarticle
5742
5743 !! test
5744 Template as link source
5745 !! input
5746 [[{{linktest2}}]]
5747
5748 [[{{linktest2}}|Main Page]]
5749
5750 [[{{linktest2}}]]Page
5751 !! result
5752 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5753 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5754 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5755 </p>
5756 !! end
5757
5758
5759 !! article
5760 Template:loop1
5761 !! text
5762 {{loop2}}
5763 !! endarticle
5764
5765 !! article
5766 Template:loop2
5767 !! text
5768 {{loop1}}
5769 !! endarticle
5770
5771 !! test
5772 Template infinite loop
5773 !! input
5774 {{loop1}}
5775 !! result
5776 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5777 </p>
5778 !! end
5779
5780 !! test
5781 Template from main namespace
5782 !! input
5783 {{:Main Page}}
5784 !! result
5785 <p>blah blah
5786 </p>
5787 !! end
5788
5789 !! article
5790 Template:table
5791 !! text
5792 {|
5793 | 1 || 2
5794 |-
5795 | 3 || 4
5796 |}
5797 !! endarticle
5798
5799 !! test
5800 BUG 529: Template with table, not included at beginning of line
5801 !! input
5802 foo {{table}}
5803 !! result
5804 <p>foo
5805 </p>
5806 <table>
5807 <tr>
5808 <td> 1 </td>
5809 <td> 2
5810 </td></tr>
5811 <tr>
5812 <td> 3 </td>
5813 <td> 4
5814 </td></tr></table>
5815
5816 !! end
5817
5818 !! test
5819 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5820 !! input
5821 foo
5822 {{table}}
5823 !! result
5824 <p>foo
5825 </p>
5826 <table>
5827 <tr>
5828 <td> 1 </td>
5829 <td> 2
5830 </td></tr>
5831 <tr>
5832 <td> 3 </td>
5833 <td> 4
5834 </td></tr></table>
5835
5836 !! end
5837
5838 !! test
5839 BUG 41: Template parameters shown as broken links
5840 !! input
5841 {{{parameter}}}
5842 !! result
5843 <p>{{{parameter}}}
5844 </p>
5845 !! end
5846
5847 !! test
5848 Template with targets containing wikilinks
5849 !! input
5850 {{[[foo]]}}
5851
5852 {{[[{{echo|foo}}]]}}
5853
5854 {{{{echo|[[foo}}]]}}
5855 !! result
5856 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5857 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5858 </p><p>{{[[foo}}]]
5859 </p>
5860 !! end
5861
5862 !! article
5863 Template:MSGNW test
5864 !! text
5865 ''None'' of '''this''' should be
5866 * interpreted
5867 but rather passed unmodified
5868 {{test}}
5869 !! endarticle
5870
5871 # hmm, fix this or just deprecate msgnw and document its behavior?
5872 !! test
5873 msgnw keyword
5874 !! options
5875 disabled
5876 !! input
5877 {{msgnw:MSGNW test}}
5878 !! result
5879 <p>''None'' of '''this''' should be
5880 * interpreted
5881 but rather passed unmodified
5882 {{test}}
5883 </p>
5884 !! end
5885
5886 !! test
5887 int keyword
5888 !! input
5889 {{int:youhavenewmessages|lots of money|not!}}
5890 !! result
5891 <p>You have lots of money (not!).
5892 </p>
5893 !! end
5894
5895 !! article
5896 Template:Includes
5897 !! text
5898 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5899 !! endarticle
5900
5901 !! test
5902 <includeonly> and <noinclude> being included
5903 !! input
5904 {{Includes}}
5905 !! result
5906 <p>Foobar
5907 </p>
5908 !! end
5909
5910 !! article
5911 Template:Includes2
5912 !! text
5913 <onlyinclude>Foo</onlyinclude>bar
5914 !! endarticle
5915
5916 !! test
5917 <onlyinclude> being included
5918 !! input
5919 {{Includes2}}
5920 !! result
5921 <p>Foo
5922 </p>
5923 !! end
5924
5925
5926 !! article
5927 Template:Includes3
5928 !! text
5929 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5930 !! endarticle
5931
5932 !! test
5933 <onlyinclude> and <includeonly> being included
5934 !! input
5935 {{Includes3}}
5936 !! result
5937 <p>Foo
5938 </p>
5939 !! end
5940
5941 !! test
5942 <includeonly> and <noinclude> on a page
5943 !! input
5944 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5945 !! result
5946 <p>Foozar
5947 </p>
5948 !! end
5949
5950 !! test
5951 Un-closed <noinclude>
5952 !! input
5953 <noinclude>
5954 !! result
5955 !! end
5956
5957 !! test
5958 <onlyinclude> on a page
5959 !! input
5960 <onlyinclude>Foo</onlyinclude>bar
5961 !! result
5962 <p>Foobar
5963 </p>
5964 !! end
5965
5966 !! test
5967 Un-closed <onlyinclude>
5968 !! input
5969 <onlyinclude>
5970 !! result
5971 !! end
5972
5973 !!test
5974 Self-closed noinclude, includeonly, onlyinclude tags
5975 !!input
5976 <noinclude />
5977 <includeonly />
5978 <onlyinclude />
5979 !!result
5980 <p><br />
5981 </p>
5982 !!end
5983
5984 !!test
5985 Unbalanced includeonly and noinclude tags
5986 !!input
5987 {|
5988 |a</noinclude>
5989 |b</noinclude></noinclude>
5990 |c</noinclude></includeonly>
5991 |d</includeonly></includeonly>
5992 |}
5993 !!result
5994 <table>
5995 <tr>
5996 <td>a
5997 </td>
5998 <td>b
5999 </td>
6000 <td>c&lt;/includeonly&gt;
6001 </td>
6002 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
6003 </td></tr></table>
6004
6005 !!end
6006
6007 !! article
6008 Template:Includeonly section
6009 !! text
6010 <includeonly>
6011 ==Includeonly section==
6012 </includeonly>
6013 ==Section T-1==
6014 !!endarticle
6015
6016 !! test
6017 Bug 6563: Edit link generation for section shown by <includeonly>
6018 !! input
6019 {{includeonly section}}
6020 !! result
6021 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
6022 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
6023
6024 !! end
6025
6026 # Uses same input as the contents of [[Template:Includeonly section]]
6027 !! test
6028 Bug 6563: Section extraction for section shown by <includeonly>
6029 !! options
6030 section=T-2
6031 !! input
6032 <includeonly>
6033 ==Includeonly section==
6034 </includeonly>
6035 ==Section T-2==
6036 !! result
6037 ==Section T-2==
6038 !! end
6039
6040 !! test
6041 Bug 6563: Edit link generation for section suppressed by <includeonly>
6042 !! input
6043 <includeonly>
6044 ==Includeonly section==
6045 </includeonly>
6046 ==Section 1==
6047 !! result
6048 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6049
6050 !! end
6051
6052 !! test
6053 Bug 6563: Section extraction for section suppressed by <includeonly>
6054 !! options
6055 section=1
6056 !! input
6057 <includeonly>
6058 ==Includeonly section==
6059 </includeonly>
6060 ==Section 1==
6061 !! result
6062 ==Section 1==
6063 !! end
6064
6065 !! test
6066 Un-closed <includeonly>
6067 !! input
6068 <includeonly>
6069 !! result
6070 !! end
6071
6072 ###
6073 ### <includeonly> and <noinclude> in attributes
6074 ###
6075 !!test
6076 0. includeonly around the entire attribute
6077 !!input
6078 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6079 !!result
6080 <p><span id="v2">bar</span>
6081 </p>
6082 !!end
6083
6084 !!test
6085 1. includeonly in html attr key
6086 !!input
6087 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6088 !!result
6089 <p><span id="foo">bar</span>
6090 </p>
6091 !!end
6092
6093 !!test
6094 2. includeonly in html attr value
6095 !!input
6096 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6097 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6098 !!result
6099 <p><span id="v1">bar</span>
6100 <span id="v1">bar</span>
6101 </p>
6102 !!end
6103
6104 !!test
6105 3. includeonly in part of an attr value
6106 !!input
6107 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6108 !!result
6109 <p><span style="color:red;">bar</span>
6110 </p>
6111 !!end
6112
6113 ###
6114 ### Testing parsing of templates where a template arg
6115 ### has the same name as the template itself.
6116 ###
6117
6118 !! article
6119 Template:quote
6120 !! text
6121 {{{quote|{{{1}}}}}}
6122 !! endarticle
6123
6124 !!test
6125 Templates: Template Name/Arg clash: 1. Use of positional param
6126 !!input
6127 {{quote|foo}}
6128 !!result
6129 <p>foo
6130 </p>
6131 !!end
6132
6133 !!test
6134 Templates: Template Name/Arg clash: 2. Use of named param
6135 !!input
6136 {{quote|quote=foo}}
6137 !!result
6138 <p>foo
6139 </p>
6140 !!end
6141
6142 !!test
6143 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6144 !!input
6145 {{quote|quote}}
6146 !!result
6147 <p>quote
6148 </p>
6149 !!end
6150
6151 ###
6152 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6153 ###
6154
6155 !!test
6156 Templates: 1. Simple use
6157 !!input
6158 {{echo|Foo}}
6159 !!result
6160 <p>Foo
6161 </p>
6162 !!end
6163
6164 !!test
6165 Templates: 2. Inside a block tag
6166 !!input
6167 <div>{{echo|Foo}}</div>
6168 !!result
6169 <div>Foo</div>
6170
6171 !!end
6172
6173 !!test
6174 Templates: P-wrapping: 1a. Templates on consecutive lines
6175 !!input
6176 {{echo|Foo}}
6177 {{echo|bar}}
6178 !!result
6179 <p>Foo
6180 bar
6181 </p>
6182 !!end
6183
6184 !!test
6185 Templates: P-wrapping: 1b. Templates on consecutive lines
6186 !!input
6187 Foo
6188
6189 {{echo|bar}}
6190 {{echo|baz}}
6191 !!result
6192 <p>Foo
6193 </p><p>bar
6194 baz
6195 </p>
6196 !!end
6197
6198 !!test
6199 Templates: P-wrapping: 1c. Templates on consecutive lines
6200 !!input
6201 {{echo|Foo}}
6202 {{echo|bar}} <div>baz</div>
6203 !!result
6204 <p>Foo
6205 </p>
6206 bar <div>baz</div>
6207
6208 !!end
6209
6210 !!test
6211 Templates: P-wrapping: 1d. Template preceded by comment-only line
6212 !!options
6213 parsoid=wt2html,wt2wt
6214 !!input
6215 <!-- foo -->
6216 {{echo|Bar}}
6217 !!result
6218 <!-- foo -->
6219 <p typeof="mw:Object/Template">Bar
6220 </p>
6221 !!end
6222
6223 !!test
6224 Templates: Inline Text: 1. Multiple tmeplate uses
6225 !!input
6226 {{echo|Foo}}bar{{echo|baz}}
6227 !!result
6228 <p>Foobarbaz
6229 </p>
6230 !!end
6231
6232 !!test
6233 Templates: Inline Text: 2. Back-to-back template uses
6234 !!input
6235 {{echo|Foo}}{{echo|bar}}
6236 !!result
6237 <p>Foobar
6238 </p>
6239 !!end
6240
6241 !!test
6242 Templates: Block Tags: 1. Multiple template uses
6243 !!input
6244 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6245 !!result
6246 <div>Foo</div><div>bar</div><div>baz</div>
6247
6248 !!end
6249
6250 !!test
6251 Templates: Block Tags: 2. Back-to-back template uses
6252 !!input
6253 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6254 !!result
6255 <div>Foo</div><div>bar</div>
6256
6257 !!end
6258
6259 !!test
6260 Templates: Links: 1. Simple example
6261 !!input
6262 {{echo|[[Foo|bar]]}}
6263 !!result
6264 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6265 </p>
6266 !!end
6267
6268 !!test
6269 Templates: Links: 2. Generation of link href
6270 !!input
6271 [[{{echo|Foo}}|bar]]
6272 !!result
6273 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6274 </p>
6275 !!end
6276
6277 !!test
6278 Templates: Links: 3. Generation of part of a link href
6279 !!input
6280 [[Fo{{echo|o}}|bar]]
6281
6282 [[Foo{{echo|bar}}]]
6283
6284 [[Foo{{echo|bar}}baz]]
6285
6286 [[Foo{{echo|bar}}|bar]]
6287
6288 [[:Foo{{echo|bar}}]]
6289
6290 [[:Foo{{echo|bar}}|bar]]
6291 !!result
6292 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6293 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6294 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6295 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6296 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6297 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6298 </p>
6299 !!end
6300
6301 !!test
6302 Templates: Links: 4. Multiple templates generating link href
6303 !!input
6304 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6305 !!result
6306 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6307 </p>
6308 !!end
6309
6310 !!test
6311 Templates: Links: 5. Generation of link text
6312 !!input
6313 [[Foo|{{echo|bar}}]]
6314 !!result
6315 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6316 </p>
6317 !!end
6318
6319 !!test
6320 Templates: Links: 5. Nested templates (only outermost template should be marked)
6321 !!input
6322 {{echo|[[{{echo|Foo}}|bar]]}}
6323 !!result
6324 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6325 </p>
6326 !!end
6327
6328 !!test
6329 Templates: HTML Tag: 1. Generation of HTML attr. key
6330 !!input
6331 <div {{echo|style}}="color:red;">foo</div>
6332 !!result
6333 <div style="color:red;">foo</div>
6334
6335 !!end
6336
6337 !!test
6338 Templates: HTML Tag: 2. Generation of HTML attr. value
6339 !!input
6340 <div style={{echo|'color:red;'}}>foo</div>
6341 !!result
6342 <div style="color:red;">foo</div>
6343
6344 !!end
6345
6346 !!test
6347 Templates: HTML Tag: 3. Generation of HTML attr key and value
6348 !!input
6349 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6350 !!result
6351 <div style="color:red;">foo</div>
6352
6353 !!end
6354
6355 !!test
6356 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6357 !!input
6358 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6359 !!result
6360 <div title="This is a long title with just one piece templated">foo</div>
6361
6362 !!end
6363
6364 !!test
6365 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6366 !!input
6367 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6368 !!result
6369 <div title="This is a long title with just one piece templated">foo</div>
6370
6371 !!end
6372
6373 !!test
6374 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6375 !!input
6376 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6377 !!result
6378 <div title="This is a long title with just one piece templated">foo</div>
6379
6380 !!end
6381
6382 !!test
6383 Templates: HTML Tag: 7. Generation of partial attribute key string
6384 !!input
6385 <div st{{echo|yle}}="color:red;">foo</div>
6386 !!result
6387 <div style="color:red;">foo</div>
6388
6389 !!end
6390
6391 !!test
6392 Templates: HTML Tables: 1. Generating start of a HTML table
6393 !!input
6394 {{echo|<table><tr><td>foo</td>}}</tr></table>
6395 !!result
6396 <table><tr><td>foo</td></tr></table>
6397
6398 !!end
6399
6400 !!test
6401 Templates: HTML Tables: 2a. Generating middle of a HTML table
6402 !!input
6403 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6404 !!result
6405 <table><tr><td>foo</td></tr></table>
6406
6407 !!end
6408
6409 !!test
6410 Templates: HTML Tables: 2b. Generating middle of a HTML table
6411 !!input
6412 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6413 !!result
6414 <table><tr><td>foo</td></tr></table>
6415
6416 !!end
6417
6418 !!test
6419 Templates: HTML Tables: 3. Generating end of a HTML table
6420 !!input
6421 <table><tr>{{echo|<td>foo</td></tr></table>}}
6422 !!result
6423 <table><tr><td>foo</td></tr></table>
6424
6425 !!end
6426
6427 !!test
6428 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6429 !!input
6430 {{echo|<table>}}<tr><td>foo</td></tr></table>
6431 !!result
6432 <table><tr><td>foo</td></tr></table>
6433
6434 !!end
6435
6436 !!test
6437 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6438 !!input
6439 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6440 !!result
6441 <table><tr><td>foo</td></tr></table>
6442
6443 !!end
6444
6445 !!test
6446 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6447 !!input
6448 <table><tr>{{echo|<td>}}foo</td></tr></table>
6449 !!result
6450 <table><tr><td>foo</td></tr></table>
6451
6452 !!end
6453
6454 !!test
6455 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6456 !!input
6457 <table><tr><td>foo{{echo|</td>}}</tr></table>
6458 !!result
6459 <table><tr><td>foo</td></tr></table>
6460
6461 !!end
6462
6463 !!test
6464 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6465 !!input
6466 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6467 !!result
6468 <table><tr><td>foo</td></tr></table>
6469
6470 !!end
6471
6472 !!test
6473 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6474 !!input
6475 <table><tr><td>foo</td></tr>{{echo|</table>}}
6476 !!result
6477 <table><tr><td>foo</td></tr></table>
6478
6479 !!end
6480
6481 !!test
6482 Templates: Wiki Tables: 1a. Fostering of entire template content
6483 !!input
6484 {|
6485 {{echo|a}}
6486 |}
6487 !!result
6488 <table>
6489 a
6490 <tr><td></td></tr></table>
6491
6492 !!end
6493
6494 !!test
6495 Templates: Wiki Tables: 1b. Fostering of entire template content
6496 !!input
6497 {|
6498 {{echo|<div>}}
6499 foo
6500 {{echo|</div>}}
6501 |}
6502 !!result
6503 <table>
6504 <div>
6505 <p>foo
6506 </p>
6507 </div>
6508 <tr><td></td></tr></table>
6509
6510 !!end
6511
6512 !!test
6513 Templates: Wiki Tables: 2. Fostering of partial template content
6514 !!input
6515 {|
6516 {{echo|a
6517 <div>b</div>}}
6518 |}
6519 !!result
6520 <table>
6521 a
6522 <div>b</div>
6523 <tr><td></td></tr></table>
6524
6525 !!end
6526
6527 !!test
6528 Templates: Wiki Tables: 3. td-content via multiple templates
6529 !!input
6530 {|
6531 {{echo|{{pipe}}a}}{{echo|b}}
6532 |}
6533 !!result
6534 <table>
6535 <tr>
6536 <td>ab
6537 </td></tr></table>
6538
6539 !!end
6540
6541 !!test
6542 Templates: Wiki Tables: 4. Templated tags, no content
6543 !!input
6544 {{tbl-start}}
6545 {{tbl-end}}
6546 !!result
6547 <table>
6548 <tr><td></td></tr></table>
6549
6550 !!end
6551
6552 !!test
6553 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6554 !!input
6555 {{tbl-start}}
6556 |foo
6557 {{tbl-end}}
6558 !!result
6559 <table>
6560 <tr>
6561 <td>foo
6562 </td></tr></table>
6563
6564 !!end
6565
6566 !!test
6567 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6568 !!input
6569 {{tbl-start}}
6570 {{!}}foo
6571 {{tbl-end}}
6572 !!result
6573 <table>
6574 <tr>
6575 <td>foo
6576 </td></tr></table>
6577
6578 !!end
6579
6580 !!test
6581 Templates: Lists: Multi-line list-items via templates
6582 !!input
6583 *{{echo|a {{nonexistent|
6584 unused}}}}
6585 *{{echo|b {{nonexistent|
6586 unused}}}}
6587 !!result
6588 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6589 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6590 </li></ul>
6591
6592 !!end
6593
6594 !!test
6595 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6596 !!input
6597 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6598 !!result
6599 <p><i>ab</i>c<i>d</i>e
6600 </p>
6601 !!end
6602
6603 !!test
6604 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6605 (PHP parser generates misnested html)
6606 !! options
6607 parsoid=wt2html,wt2wt
6608 !!input
6609 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6610 !!result
6611 <p><span typeof="mw:Object/Template"><i>a</i></span><i typeof="mw:Object/Template"><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6612 !!end
6613
6614 !!test
6615 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6616 (PHP parser generates misnested html)
6617 !! options
6618 parsoid=wt2html,wt2wt
6619 !!input
6620 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6621 !!result
6622 <div typeof="mw:Object/Template"><i>a</i></div>
6623 <div typeof="mw:Object/Template"><i>b</i>c<i>d</i></div>
6624 <div typeof="mw:Object/Template">e</div>
6625 !!end
6626
6627 !!test
6628 Templates: Ugly nesting: 4. Divs opened/closed across templates
6629 !!input
6630 a<div>b{{echo|c</div>d}}e
6631 !!result
6632 a<div>bc</div>de
6633
6634 !!end
6635
6636 !!test
6637 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6638 (Parsoid-centric)
6639 !! options
6640 parsoid
6641 !!input
6642 {|
6643 |{{echo|foo</table>}}
6644 |bar
6645 |}
6646 !!result
6647 <table typeof="mw:Object/Template">
6648 <tbody>
6649 <tr>
6650 <td>foo</td></tr></tbody></table><span>bar</span>
6651 !!end
6652
6653 !!test
6654 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6655 (Parsoid-centric)
6656 !! options
6657 parsoid
6658 !!input
6659 <table>
6660 <tr>
6661 <td>
6662 <table>
6663 <tr>
6664 <td>1. {{echo|foo </table>}}</td>
6665 <td> bar </td>
6666 <td>2. {{echo|baz </table>}}</td>
6667 </tr>
6668 <tr>
6669 <td>abc</td>
6670 </tr>
6671 </table>
6672 </td>
6673 </tr>
6674 <tr>
6675 <td>xyz</td>
6676 </tr>
6677 </table>
6678 !!result
6679 <table about="#mwt1" typeof="mw:Object/Template">
6680 <tbody><tr >
6681 <td >
6682 <table >
6683 <tbody><tr >
6684 <td >1. foo </td></tr></tbody></table></td>
6685 <td > bar </td>
6686 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6687 </span><span about="#mwt1">
6688
6689 abc</span><span about="#mwt1">
6690 </span><span about="#mwt1">
6691 </span><span about="#mwt1">
6692 </span><span about="#mwt1">
6693 </span><span about="#mwt1">
6694
6695 xyz</span><span about="#mwt1">
6696 </span><span about="#mwt1">
6697 </span>
6698 !!end
6699
6700 !! test
6701 Templates: Ugly templates: 3. newline-only template parameter
6702 !! input
6703 foo {{echo|
6704 }}
6705 !! result
6706 <p>foo
6707 </p>
6708 !! end
6709
6710 # This looks like a bug: a single newline triggers p/br for some reason.
6711 !! test
6712 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6713 !! input
6714 {{echo|
6715 }}
6716 !! result
6717 <p><br />
6718 </p>
6719 !! end
6720
6721
6722 !!test
6723 Parser Functions: 1. Simple example
6724 !!input
6725 {{uc:foo}}
6726 !!result
6727 <p>FOO
6728 </p>
6729 !!end
6730
6731 !!test
6732 Parser Functions: 2. Nested use (only outermost should be marked up)
6733 !!input
6734 {{uc:{{lc:FOO}}}}
6735 !!result
6736 <p>FOO
6737 </p>
6738 !!end
6739
6740 ###
6741 ### Pre-save transform tests
6742 ###
6743 !! test
6744 pre-save transform: subst:
6745 !! options
6746 PST
6747 !! input
6748 {{subst:test}}
6749 !! result
6750 This is a test template
6751 !! end
6752
6753 !! test
6754 pre-save transform: normal template
6755 !! options
6756 PST
6757 !! input
6758 {{test}}
6759 !! result
6760 {{test}}
6761 !! end
6762
6763 !! test
6764 pre-save transform: nonexistent template
6765 !! options
6766 PST
6767 !! input
6768 {{thistemplatedoesnotexist}}
6769 !! result
6770 {{thistemplatedoesnotexist}}
6771 !! end
6772
6773
6774 !! test
6775 pre-save transform: subst magic variables
6776 !! options
6777 PST
6778 !! input
6779 {{subst:SITENAME}}
6780 !! result
6781 MediaWiki
6782 !! end
6783
6784 # This is bug 89, which I fixed. -- wtm
6785 !! test
6786 pre-save transform: subst: templates with parameters
6787 !! options
6788 pst
6789 !! input
6790 {{subst:paramtest|param="something else"}}
6791 !! result
6792 This is a test template with parameter "something else"
6793 !! end
6794
6795 !! article
6796 Template:nowikitest
6797 !! text
6798 <nowiki>'''not wiki'''</nowiki>
6799 !! endarticle
6800
6801 !! test
6802 pre-save transform: nowiki in subst (bug 1188)
6803 !! options
6804 pst
6805 !! input
6806 {{subst:nowikitest}}
6807 !! result
6808 <nowiki>'''not wiki'''</nowiki>
6809 !! end
6810
6811
6812 !! article
6813 Template:commenttest
6814 !! text
6815 This template has <!-- a comment --> in it.
6816 !! endarticle
6817
6818 !! test
6819 pre-save transform: comment in subst (bug 1936)
6820 !! options
6821 pst
6822 !! input
6823 {{subst:commenttest}}
6824 !! result
6825 This template has <!-- a comment --> in it.
6826 !! end
6827
6828 !! test
6829 pre-save transform: unclosed tag
6830 !! options
6831 pst noxml
6832 !! input
6833 <nowiki>'''not wiki'''
6834 !! result
6835 <nowiki>'''not wiki'''
6836 !! end
6837
6838 !! test
6839 pre-save transform: mixed tag case
6840 !! options
6841 pst noxml
6842 !! input
6843 <NOwiki>'''not wiki'''</noWIKI>
6844 !! result
6845 <NOwiki>'''not wiki'''</noWIKI>
6846 !! end
6847
6848 !! test
6849 pre-save transform: unclosed comment in <nowiki>
6850 !! options
6851 pst noxml
6852 !! input
6853 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6854 !! result
6855 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6856 !!end
6857
6858 # Leading @ in this template definition works around a limitation
6859 # in parsoid's parserTests which otherwise strips the <span> from the
6860 # result (confusing it for a template wrapper)
6861 !! article
6862 Template:dangerous
6863 !!text
6864 @<span onmouseover="alert('crap')">Oh no</span>
6865 !!endarticle
6866
6867 !!test
6868 (confirming safety of fix for subst bug 1936)
6869 !! input
6870 {{Template:dangerous}}
6871 !! result
6872 <p>@<span>Oh no</span>
6873 </p>
6874 !! end
6875
6876 !! test
6877 pre-save transform: comment containing gallery (bug 5024)
6878 !! options
6879 pst
6880 !! input
6881 <!-- <gallery>data</gallery> -->
6882 !!result
6883 <!-- <gallery>data</gallery> -->
6884 !!end
6885
6886 !! test
6887 pre-save transform: comment containing extension
6888 !! options
6889 pst
6890 !! input
6891 <!-- <tag>data</tag> -->
6892 !!result
6893 <!-- <tag>data</tag> -->
6894 !!end
6895
6896 !! test
6897 pre-save transform: comment containing nowiki
6898 !! options
6899 pst
6900 !! input
6901 <!-- <nowiki>data</nowiki> -->
6902 !!result
6903 <!-- <nowiki>data</nowiki> -->
6904 !!end
6905
6906 !! test
6907 pre-save transform: <noinclude> in subst (bug 3298)
6908 !! options
6909 pst
6910 !! input
6911 {{subst:Includes}}
6912 !! result
6913 Foobar
6914 !! end
6915
6916 !! test
6917 pre-save transform: <onlyinclude> in subst (bug 3298)
6918 !! options
6919 pst
6920 !! input
6921 {{subst:Includes2}}
6922 !! result
6923 Foo
6924 !! end
6925
6926 !! article
6927 Template:SubstTest
6928 !!text
6929 {{<includeonly>subst:</includeonly>Includes}}
6930 !! endarticle
6931
6932 !! article
6933 Template:SafeSubstTest
6934 !! text
6935 {{<includeonly>safesubst:</includeonly>Includes}}
6936 !! endarticle
6937
6938 !! test
6939 bug 22297: safesubst: works during PST
6940 !! options
6941 pst
6942 !! input
6943 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6944 !! result
6945 FoobarFoobar
6946 !! end
6947
6948 !! test
6949 bug 22297: safesubst: works during normal parse
6950 !! input
6951 {{SafeSubstTest}}
6952 !! result
6953 <p>Foobar
6954 </p>
6955 !! end
6956
6957 !! test:
6958 subst: does not work during normal parse
6959 !! input
6960 {{SubstTest}}
6961 !! result
6962 <p>{{subst:Includes}}
6963 </p>
6964 !! end
6965
6966 !! test
6967 pre-save transform: context links ("pipe trick")
6968 !! options
6969 pst
6970 !! input
6971 [[Article (context)|]]
6972 [[Bar:Article|]]
6973 [[:Bar:Article|]]
6974 [[Bar:Article (context)|]]
6975 [[:Bar:Article (context)|]]
6976 [[|Article]]
6977 [[|Article (context)]]
6978 [[Bar:X (Y) Z|]]
6979 [[:Bar:X (Y) Z|]]
6980 !! result
6981 [[Article (context)|Article]]
6982 [[Bar:Article|Article]]
6983 [[:Bar:Article|Article]]
6984 [[Bar:Article (context)|Article]]
6985 [[:Bar:Article (context)|Article]]
6986 [[Article]]
6987 [[Article (context)]]
6988 [[Bar:X (Y) Z|X (Y) Z]]
6989 [[:Bar:X (Y) Z|X (Y) Z]]
6990 !! end
6991
6992 !! test
6993 pre-save transform: context links ("pipe trick") with interwiki prefix
6994 !! options
6995 pst
6996 !! input
6997 [[interwiki:Article|]]
6998 [[:interwiki:Article|]]
6999 [[interwiki:Bar:Article|]]
7000 [[:interwiki:Bar:Article|]]
7001 !! result
7002 [[interwiki:Article|Article]]
7003 [[:interwiki:Article|Article]]
7004 [[interwiki:Bar:Article|Bar:Article]]
7005 [[:interwiki:Bar:Article|Bar:Article]]
7006 !! end
7007
7008 !! test
7009 pre-save transform: context links ("pipe trick") with parens in title
7010 !! options
7011 pst title=[[Somearticle (context)]]
7012 !! input
7013 [[|Article]]
7014 !! result
7015 [[Article (context)|Article]]
7016 !! end
7017
7018 !! test
7019 pre-save transform: context links ("pipe trick") with comma in title
7020 !! options
7021 pst title=[[Someplace, Somewhere]]
7022 !! input
7023 [[|Otherplace]]
7024 [[Otherplace, Elsewhere|]]
7025 [[Otherplace, Elsewhere, Anywhere|]]
7026 !! result
7027 [[Otherplace, Somewhere|Otherplace]]
7028 [[Otherplace, Elsewhere|Otherplace]]
7029 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
7030 !! end
7031
7032 !! test
7033 pre-save transform: context links ("pipe trick") with parens and comma
7034 !! options
7035 pst title=[[Someplace (IGNORED), Somewhere]]
7036 !! input
7037 [[|Otherplace]]
7038 [[Otherplace (place), Elsewhere|]]
7039 !! result
7040 [[Otherplace, Somewhere|Otherplace]]
7041 [[Otherplace (place), Elsewhere|Otherplace]]
7042 !! end
7043
7044 !! test
7045 pre-save transform: context links ("pipe trick") with comma and parens
7046 !! options
7047 pst title=[[Who, me? (context)]]
7048 !! input
7049 [[|Yes, you.]]
7050 [[Me, Myself, and I (1937 song)|]]
7051 !! result
7052 [[Yes, you. (context)|Yes, you.]]
7053 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7054 !! end
7055
7056 !! test
7057 pre-save transform: context links ("pipe trick") with namespace
7058 !! options
7059 pst title=[[Ns:Somearticle]]
7060 !! input
7061 [[|Article]]
7062 !! result
7063 [[Ns:Article|Article]]
7064 !! end
7065
7066 !! test
7067 pre-save transform: context links ("pipe trick") with namespace and parens
7068 !! options
7069 pst title=[[Ns:Somearticle (context)]]
7070 !! input
7071 [[|Article]]
7072 !! result
7073 [[Ns:Article (context)|Article]]
7074 !! end
7075
7076 !! test
7077 pre-save transform: context links ("pipe trick") with namespace and comma
7078 !! options
7079 pst title=[[Ns:Somearticle, Context, Whatever]]
7080 !! input
7081 [[|Article]]
7082 !! result
7083 [[Ns:Article, Context, Whatever|Article]]
7084 !! end
7085
7086 !! test
7087 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7088 !! options
7089 pst title=[[Ns:Somearticle, Context (context)]]
7090 !! input
7091 [[|Article]]
7092 !! result
7093 [[Ns:Article (context)|Article]]
7094 !! end
7095
7096 !! test
7097 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7098 !! options
7099 pst title=[[Ns:Somearticle (IGNORED), Context]]
7100 !! input
7101 [[|Article]]
7102 !! result
7103 [[Ns:Article, Context|Article]]
7104 !! end
7105
7106 !! test
7107 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7108 !! options
7109 pst
7110 !! input
7111 [[Article(context)|]]
7112 [[Bar:Article(context)|]]
7113 [[:Bar:Article(context)|]]
7114 [[|Article(context)]]
7115 [[Bar:X(Y)Z|]]
7116 [[:Bar:X(Y)Z|]]
7117 !! result
7118 [[Article(context)|Article]]
7119 [[Bar:Article(context)|Article]]
7120 [[:Bar:Article(context)|Article]]
7121 [[Article(context)]]
7122 [[Bar:X(Y)Z|X(Y)Z]]
7123 [[:Bar:X(Y)Z|X(Y)Z]]
7124 !! end
7125
7126 !! test
7127 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7128 !! options
7129 pst
7130 !! input
7131 [[Article (context)|]]
7132 [[Bar:Article (context)|]]
7133 [[:Bar:Article (context)|]]
7134 [[|Article (context)]]
7135 [[Bar:X (Y) Z|]]
7136 [[:Bar:X (Y) Z|]]
7137 !! result
7138 [[Article (context)|Article]]
7139 [[Bar:Article (context)|Article]]
7140 [[:Bar:Article (context)|Article]]
7141 [[Article (context)]]
7142 [[Bar:X (Y) Z|X (Y) Z]]
7143 [[:Bar:X (Y) Z|X (Y) Z]]
7144 !! end
7145
7146 !! test
7147 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7148 !! options
7149 pst
7150 !! input
7151 [[Article(context)|]]
7152 [[Bar:Article(context)|]]
7153 [[:Bar:Article(context)|]]
7154 [[|Article(context)]]
7155 [[Bar:X(Y)Z|]]
7156 [[:Bar:X(Y)Z|]]
7157 !! result
7158 [[Article(context)|Article]]
7159 [[Bar:Article(context)|Article]]
7160 [[:Bar:Article(context)|Article]]
7161 [[Article(context)]]
7162 [[Bar:X(Y)Z|X(Y)Z]]
7163 [[:Bar:X(Y)Z|X(Y)Z]]
7164 !! end
7165
7166 !! test
7167 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7168 !! options
7169 pst
7170 !! input
7171 [[Article (context), context|]]
7172 [[Article (context),context|]]
7173 [[Bar:Article (context), context|]]
7174 [[Bar:Article (context),context|]]
7175 [[:Bar:Article (context), context|]]
7176 [[:Bar:Article (context),context|]]
7177 !! result
7178 [[Article (context), context|Article]]
7179 [[Article (context),context|Article]]
7180 [[Bar:Article (context), context|Article]]
7181 [[Bar:Article (context),context|Article]]
7182 [[:Bar:Article (context), context|Article]]
7183 [[:Bar:Article (context),context|Article]]
7184 !! end
7185
7186 !! test
7187 pre-save transform: trim trailing empty lines
7188 !! options
7189 pst
7190 !! input
7191 Empty lines are trimmed
7192
7193
7194
7195
7196 !! result
7197 Empty lines are trimmed
7198 !! end
7199
7200 !! test
7201 pre-save transform: Signature expansion
7202 !! options
7203 pst
7204 !! input
7205 * ~~~
7206 * <noinclude>~~~</noinclude>
7207 * <includeonly>~~~</includeonly>
7208 * <onlyinclude>~~~</onlyinclude>
7209 !! result
7210 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7211 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7212 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7213 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7214 !! end
7215
7216
7217 !! test
7218 pre-save transform: Signature expansion in nowiki tags (bug 93)
7219 !! options
7220 pst disabled
7221 !! input
7222 Shall not expand:
7223
7224 <nowiki>~~~~</nowiki>
7225
7226 <includeonly><nowiki>~~~~</nowiki></includeonly>
7227
7228 <noinclude><nowiki>~~~~</nowiki></noinclude>
7229
7230 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7231
7232 {{subst:Foo}} shall be converted to FOO
7233
7234 As well as inside noinclude/onlyinclude
7235 <noinclude>{{subst:Foo}}</noinclude>
7236 <onlyinclude>{{subst:Foo}}</onlyinclude>
7237
7238 But not inside includeonly
7239 <includeonly>{{subst:Foo}}</includeonly>
7240 !! result
7241 Shall not expand:
7242
7243 <nowiki>~~~~</nowiki>
7244
7245 <includeonly><nowiki>~~~~</nowiki></includeonly>
7246
7247 <noinclude><nowiki>~~~~</nowiki></noinclude>
7248
7249 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7250
7251 FOO shall be converted to FOO
7252
7253 As well as inside noinclude/onlyinclude
7254 <noinclude>FOO</noinclude>
7255 <onlyinclude>FOO</onlyinclude>
7256
7257 But not inside includeonly
7258 <includeonly>{{subst:Foo}}</includeonly>
7259 !! end
7260
7261 ###
7262 ### Message transform tests
7263 ###
7264 !! test
7265 message transform: magic variables
7266 !! options
7267 msg
7268 !! input
7269 {{SITENAME}}
7270 !! result
7271 MediaWiki
7272 !! end
7273
7274 !! test
7275 message transform: should not transform wiki markup
7276 !! options
7277 msg
7278 !! input
7279 ''test''
7280 !! result
7281 ''test''
7282 !! end
7283
7284 !! test
7285 message transform: <noinclude> in transcluded template (bug 4926)
7286 !! options
7287 msg
7288 !! input
7289 {{Includes}}
7290 !! result
7291 Foobar
7292 !! end
7293
7294 !! test
7295 message transform: <onlyinclude> in transcluded template (bug 4926)
7296 !! options
7297 msg
7298 !! input
7299 {{Includes2}}
7300 !! result
7301 Foo
7302 !! end
7303
7304 !! test
7305 {{#special:}} page name, known
7306 !! options
7307 msg
7308 !! input
7309 {{#special:Recentchanges}}
7310 !! result
7311 Special:RecentChanges
7312 !! end
7313
7314 !! test
7315 {{#special:}} page name with subpage, known
7316 !! options
7317 msg
7318 !! input
7319 {{#special:Recentchanges/param}}
7320 !! result
7321 Special:RecentChanges/param
7322 !! end
7323
7324 !! test
7325 {{#special:}} page name, unknown
7326 !! options
7327 msg
7328 !! input
7329 {{#special:foobarnonexistent}}
7330 !! result
7331 No such special page
7332 !! end
7333
7334 !! test
7335 {{#speciale:}} page name, known
7336 !! options
7337 msg
7338 !! input
7339 {{#speciale:Recentchanges}}
7340 !! result
7341 Special:RecentChanges
7342 !! end
7343
7344 !! test
7345 {{#speciale:}} page name with subpage, known
7346 !! options
7347 msg
7348 !! input
7349 {{#speciale:Recentchanges/param}}
7350 !! result
7351 Special:RecentChanges/param
7352 !! end
7353
7354 !! test
7355 {{#speciale:}} page name, unknown
7356 !! options
7357 msg
7358 !! input
7359 {{#speciale:foobarnonexistent}}
7360 !! result
7361 No_such_special_page
7362 !! end
7363
7364 ###
7365 ### Images
7366 ###
7367 !! test
7368 Simple image
7369 !! input
7370 [[Image:foobar.jpg]]
7371 !! result
7372 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7373 </p>
7374 !! end
7375
7376 !! test
7377 Right-aligned image
7378 !! input
7379 [[Image:foobar.jpg|right]]
7380 !! result
7381 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7382
7383 !! end
7384
7385 !! test
7386 Simple image (using File: namespace, now canonical)
7387 !! input
7388 [[File:foobar.jpg]]
7389 !! result
7390 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7391 </p>
7392 !! end
7393
7394 !! test
7395 Image with caption
7396 !! input
7397 [[Image:foobar.jpg|right|Caption text]]
7398 !! result
7399 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7400
7401 !! end
7402
7403 !! test
7404 Image with empty attribute
7405 !! input
7406 [[Image:foobar.jpg|right||Caption text]]
7407 !! result
7408 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7409
7410 !! end
7411
7412 !! test
7413 Image with link tails
7414 !! input
7415 123[[Image:foobar.jpg]]456
7416 123[[Image:foobar.jpg|right]]456
7417 123[[Image:foobar.jpg|thumb]]456
7418 !! result
7419 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7420 </p>
7421 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7422 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7423
7424 !! end
7425
7426 !! test
7427 Image with multiple captions -- only last one is accepted
7428 !! input
7429 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7430 !! result
7431 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7432
7433 !! end
7434
7435 !! test
7436 Image with width attribute at different positions
7437 !! input
7438 [[Image:foobar.jpg|200px|right|Caption]]
7439 [[Image:foobar.jpg|right|200px|Caption]]
7440 [[Image:foobar.jpg|right|Caption|200px]]
7441 !! result
7442 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7443 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7444 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7445
7446 !! end
7447
7448 !! test
7449 Image with link parameter, wiki target
7450 !! input
7451 [[Image:foobar.jpg|link=Target page]]
7452 !! result
7453 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7454 </p>
7455 !! end
7456
7457 !! test
7458 Image with link parameter, URL target
7459 !! input
7460 [[Image:foobar.jpg|link=http://example.com/]]
7461 !! result
7462 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7463 </p>
7464 !! end
7465
7466 !! test
7467 Image with link parameter, wgExternalLinkTarget
7468 !! input
7469 [[Image:foobar.jpg|link=http://example.com/]]
7470 !! config
7471 wgExternalLinkTarget='foobar'
7472 !! result
7473 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7474 </p>
7475 !! end
7476
7477 !! test
7478 Image with link parameter, wgNoFollowLinks set to false
7479 !! input
7480 [[Image:foobar.jpg|link=http://example.com/]]
7481 !! config
7482 wgNoFollowLinks=false
7483 !! result
7484 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7485 </p>
7486 !! end
7487
7488 !! test
7489 Image with link parameter, wgNoFollowDomainExceptions
7490 !! input
7491 [[Image:foobar.jpg|link=http://example.com/]]
7492 !! config
7493 wgNoFollowDomainExceptions='example.com'
7494 !! result
7495 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7496 </p>
7497 !! end
7498
7499 !! test
7500 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7501 !! input
7502 [[Image:foobar.jpg|link=http://example.com/|Title]]
7503 !! config
7504 wgExternalLinkTarget='foobar'
7505 !! result
7506 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7507 </p>
7508 !! end
7509
7510 !! test
7511 Image with empty link parameter
7512 !! input
7513 [[Image:foobar.jpg|link=]]
7514 !! result
7515 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7516 </p>
7517 !! end
7518
7519 !! test
7520 Image with link parameter (wiki target) and unnamed parameter
7521 !! input
7522 [[Image:foobar.jpg|link=Target page|Title]]
7523 !! result
7524 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7525 </p>
7526 !! end
7527
7528 !! test
7529 Image with link parameter (URL target) and unnamed parameter
7530 !! input
7531 [[Image:foobar.jpg|link=http://example.com/|Title]]
7532 !! result
7533 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7534 </p>
7535 !! end
7536
7537 !! test
7538 Thumbnail image with link parameter
7539 !! options
7540 php
7541 !! input
7542 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7543 !! result
7544 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7545
7546 !! end
7547
7548 !! test
7549 Manually-specified thumbnail image
7550 !! options
7551 php
7552 !! input
7553 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7554 !! result
7555 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7556
7557 !! end
7558
7559 !! test
7560 Manually-specified thumbnail image with explicit link to wiki page
7561 !! options
7562 php
7563 !! input
7564 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7565 !! result
7566 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7567
7568 !! end
7569
7570 !! test
7571 Manually-specified thumbnail image with explicit link to url
7572 !! options
7573 php
7574 !! input
7575 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7576 !! result
7577 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7578
7579 !! end
7580
7581 !! test
7582 Manually-specified thumbnail image with explicit no link
7583 !! options
7584 php
7585 !! input
7586 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7587 !! result
7588 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7589
7590 !! end
7591
7592 !! test
7593 Manually-specified thumbnail image with explicit link and alt text
7594 !! options
7595 php
7596 !! input
7597 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7598 !! result
7599 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7600
7601 !! end
7602
7603 !! test
7604 Image with frame and link
7605 !! input
7606 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7607 !! result
7608 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7609
7610 !! end
7611
7612 !! test
7613 Image with frame and link and explicit alt
7614 !! input
7615 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7616 !! result
7617 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7618
7619 !! end
7620
7621 !! test
7622 Image with wiki markup in implicit alt
7623 !! input
7624 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7625 !! result
7626 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7627 </p>
7628 !! end
7629
7630 !! test
7631 Image with wiki markup in explicit alt
7632 !! input
7633 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7634 !! result
7635 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7636 </p>
7637 !! end
7638
7639 !! test
7640 Link to image page- image page normally doesn't exists, hence edit link
7641 Add test with existing image page
7642 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7643 !! input
7644 [[:Image:test]]
7645 !! result
7646 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7647 </p>
7648 !! end
7649
7650 !! test
7651 bug 18784 Link to non-existent image page with caption should use caption as link text
7652 !! input
7653 [[:Image:test|caption]]
7654 !! result
7655 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7656 </p>
7657 !! end
7658
7659 !! test
7660 Frameless image caption with a free URL
7661 !! input
7662 [[Image:foobar.jpg|http://example.com]]
7663 !! result
7664 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7665 </p>
7666 !! end
7667
7668 !! test
7669 Thumbnail image caption with a free URL
7670 !! input
7671 [[Image:foobar.jpg|thumb|http://example.com]]
7672 !! result
7673 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7674
7675 !! end
7676
7677 !! test
7678 Thumbnail image caption with a free URL and explicit alt
7679 !! input
7680 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7681 !! result
7682 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7683
7684 !! end
7685
7686 !! test
7687 BUG 1887: A ISBN with a thumbnail
7688 !! input
7689 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7690 !! result
7691 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7692
7693 !! end
7694
7695 !! test
7696 BUG 1887: A RFC with a thumbnail
7697 !! input
7698 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7699 !! result
7700 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7701
7702 !! end
7703
7704 !! test
7705 BUG 1887: A mailto link with a thumbnail
7706 !! input
7707 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7708 !! result
7709 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7710
7711 !! end
7712
7713 # Pending resolution to bug 368
7714 !! test
7715 BUG 648: Frameless image caption with a link
7716 !! input
7717 [[Image:foobar.jpg|text with a [[link]] in it]]
7718 !! result
7719 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7720 </p>
7721 !! end
7722
7723 !! test
7724 BUG 648: Frameless image caption with a link (suffix)
7725 !! input
7726 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7727 !! result
7728 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7729 </p>
7730 !! end
7731
7732 !! test
7733 BUG 648: Frameless image caption with an interwiki link
7734 !! input
7735 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7736 !! result
7737 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7738 </p>
7739 !! end
7740
7741 !! test
7742 BUG 648: Frameless image caption with a piped interwiki link
7743 !! input
7744 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7745 !! result
7746 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7747 </p>
7748 !! end
7749
7750 !! test
7751 Escape HTML special chars in image alt text
7752 !! input
7753 [[Image:foobar.jpg|& < > "]]
7754 !! result
7755 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7756 </p>
7757 !! end
7758
7759 !! test
7760 BUG 499: Alt text should have &#1234;, not &amp;1234;
7761 !! input
7762 [[Image:foobar.jpg|&#9792;]]
7763 !! result
7764 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7765 </p>
7766 !! end
7767
7768 !! test
7769 Broken image caption with link
7770 !! input
7771 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7772 !! result
7773 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7774 </p>
7775 !! end
7776
7777 !! test
7778 Image caption containing another image
7779 !! input
7780 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7781 !! result
7782 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7783
7784 !! end
7785
7786 !! test
7787 Image caption containing a newline
7788 !! input
7789 [[Image:Foobar.jpg|This
7790 *is some text]]
7791 !! result
7792 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7793 </p>
7794 !!end
7795
7796 !!test
7797 Parsoid: Image caption containing leading space
7798 (The leading space should not trigger nowiki escaping in wt2wt mode)
7799 !! input
7800 [[Image:Foobar.jpg|thumb| bar]]
7801 !! result
7802 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7803
7804 !!end
7805
7806 !! test
7807 Bug 3090: External links other than http: in image captions
7808 !! input
7809 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7810 !! result
7811 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7812
7813 !! end
7814
7815 !! test
7816 Custom class
7817 !! input
7818 [[Image:foobar.jpg|a|class=b]]
7819 !! result
7820 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7821 </p>
7822 !! end
7823
7824 !! test
7825 Localized image handling (1).
7826 !! options
7827 language=es
7828 !! input
7829 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7830 !! result
7831 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7832
7833 !! end
7834
7835 !! test
7836 Localized image handling (2).
7837 !! options
7838 language=es
7839 !! input
7840 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7841 !! result
7842 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7843
7844 !! end
7845
7846 !! test
7847 "border", "frameless" and "class" attributes on an image.
7848 !! input
7849 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7850 !! result
7851 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7852 </p>
7853 !! end
7854
7855 !! article
7856 File:Barfoo.jpg
7857 !! text
7858 #REDIRECT [[File:Barfoo.jpg]]
7859 !! endarticle
7860
7861 !! test
7862 Redirected image
7863 !! input
7864 [[Image:Barfoo.jpg]]
7865 !! result
7866 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7867 </p>
7868 !! end
7869
7870 !! test
7871 Missing image with uploads disabled
7872 !! options
7873 wgEnableUploads=0
7874 !! input
7875 [[Image:Foobaz.jpg]]
7876 !! result
7877 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7878 </p>
7879 !! end
7880
7881
7882 ###
7883 ### Subpages
7884 ###
7885 !! article
7886 Subpage test/subpage
7887 !! text
7888 foo
7889 !! endarticle
7890
7891 !! test
7892 Subpage link
7893 !! options
7894 subpage title=[[Subpage test]]
7895 !! input
7896 [[/subpage]]
7897 !! result
7898 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7899 </p>
7900 !! end
7901
7902 !! test
7903 Subpage noslash link
7904 !! options
7905 subpage title=[[Subpage test]]
7906 !!input
7907 [[/subpage/]]
7908 !! result
7909 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7910 </p>
7911 !! end
7912
7913 !! test
7914 Disabled subpages
7915 !! input
7916 [[/subpage]]
7917 !! result
7918 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7919 </p>
7920 !! end
7921
7922 !! test
7923 BUG 561: {{/Subpage}}
7924 !! options
7925 subpage title=[[Page]]
7926 !! input
7927 {{/Subpage}}
7928 !! result
7929 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7930 </p>
7931 !! end
7932
7933 ###
7934 ### Categories
7935 ###
7936 !! article
7937 Category:MediaWiki User's Guide
7938 !! text
7939 blah
7940 !! endarticle
7941
7942 !! test
7943 Link to category
7944 !! input
7945 [[:Category:MediaWiki User's Guide]]
7946 !! result
7947 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7948 </p>
7949 !! end
7950
7951 !! test
7952 Simple category
7953 !! options
7954 cat
7955 !! input
7956 [[Category:MediaWiki User's Guide]]
7957 !! result
7958 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7959 !! end
7960
7961 !! test
7962 PAGESINCATEGORY invalid title fatal (r33546 fix)
7963 !! input
7964 {{PAGESINCATEGORY:<bogus>}}
7965 !! result
7966 <p>0
7967 </p>
7968 !! end
7969
7970 !! test
7971 Category with different sort key
7972 !! options
7973 cat
7974 !! input
7975 [[Category:MediaWiki User's Guide|Foo]]
7976 !! result
7977 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7978 !! end
7979
7980 !! test
7981 Category with identical sort key
7982 !! options
7983 cat
7984 !! input
7985 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7986 !! result
7987 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7988 !! end
7989
7990 !! test
7991 Category with empty sort key
7992 !! options
7993 cat
7994 pst
7995 !! input
7996 [[Category:MediaWiki User's Guide|]]
7997 !! result
7998 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7999 !! end
8000
8001 !! test
8002 Category with empty sort key and parentheses
8003 !! options
8004 cat
8005 pst
8006 !! input
8007 [[Category:Foo (bar)|]]
8008 !! result
8009 [[Category:Foo (bar)|Foo]]
8010 !! end
8011
8012 !! test
8013 Category with link tail
8014 !! options
8015 cat
8016 pst
8017 !! input
8018 123[[Category:Foo]]456
8019 !! result
8020 123[[Category:Foo]]456
8021 !! end
8022
8023 !! test
8024 Category with template
8025 !! options
8026 cat
8027 pst
8028 !! input
8029 [[Category:{{echo|Foo}}]]
8030 !! result
8031 [[Category:{{echo|Foo}}]]
8032 !! end
8033
8034 !! test
8035 Category with template in sort key
8036 !! options
8037 cat
8038 pst
8039 !! input
8040 [[Category:Foo|{{echo|Bar}}]]
8041 !! result
8042 [[Category:Foo|{{echo|Bar}}]]
8043 !! end
8044
8045 !! test
8046 Category with template in sort key and title
8047 !! options
8048 cat
8049 pst
8050 !! input
8051 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8052 !! result
8053 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8054 !! end
8055
8056 !! test
8057 Category / paragraph interactions
8058 !! input
8059 Foo [[Category:Baz]] Bar
8060
8061 Foo [[Category:Baz]]
8062 Bar
8063
8064 Foo
8065 [[Category:Baz]]
8066 Bar
8067
8068 Foo
8069 [[Category:Baz]] Bar
8070
8071 Foo
8072 [[Category:Baz]]
8073 [[Category:Baz]]
8074 [[Category:Baz]]
8075 Bar
8076
8077 [[Category:Baz]]
8078 [[Category:Baz]]
8079 [[Category:Baz]]
8080
8081 [[Category:Baz]]
8082 {{echo|[[Category:Baz]]}}
8083 [[Category:Baz]]
8084 !! result
8085 <p>Foo Bar
8086 </p><p>Foo
8087 Bar
8088 </p><p>Foo
8089 Bar
8090 </p><p>Foo Bar
8091 </p><p>Foo
8092 Bar
8093 </p>
8094 !! end
8095
8096 ###
8097 ### Inter-language links
8098 ###
8099 !! test
8100 Inter-language links
8101 !! options
8102 ill
8103 !! input
8104 [[es:Alimento]]
8105 [[fr:Nourriture]]
8106 [[zh:&#39135;&#21697;]]
8107 !! result
8108 es:Alimento fr:Nourriture zh:食品
8109 !! end
8110
8111 !! test
8112 Duplicate interlanguage links (bug 24502)
8113 !! options
8114 ill
8115 !! input
8116 [[es:1]]
8117 [[es:2]]
8118 [[fr:1]]
8119 [[fr:2]]
8120 !! result
8121 es:1 fr:1
8122 !! end
8123
8124 ###
8125 ### Sections
8126 ###
8127 !! test
8128 Basic section headings
8129 !! input
8130 == Headline 1 ==
8131 Some text
8132
8133 ==Headline 2==
8134 More
8135 ===Smaller headline===
8136 Blah blah
8137 !! result
8138 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8139 <p>Some text
8140 </p>
8141 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8142 <p>More
8143 </p>
8144 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8145 <p>Blah blah
8146 </p>
8147 !! end
8148
8149 !! test
8150 Section headings with TOC
8151 !! input
8152 == Headline 1 ==
8153 === Subheadline 1 ===
8154 ===== Skipping a level =====
8155 ====== Skipping a level ======
8156
8157 == Headline 2 ==
8158 Some text
8159 ===Another headline===
8160 !! result
8161 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8162 <ul>
8163 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8164 <ul>
8165 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8166 <ul>
8167 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8168 <ul>
8169 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8170 </ul>
8171 </li>
8172 </ul>
8173 </li>
8174 </ul>
8175 </li>
8176 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8177 <ul>
8178 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8179 </ul>
8180 </li>
8181 </ul>
8182 </td></tr></table>
8183 <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8184 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8185 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8186 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8187 <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8188 <p>Some text
8189 </p>
8190 <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8191
8192 !! end
8193
8194 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8195 !! test
8196 Handling of sections up to level 6 and beyond
8197 !! input
8198 = Level 1 Heading=
8199 == Level 2 Heading==
8200 === Level 3 Heading===
8201 ==== Level 4 Heading====
8202 ===== Level 5 Heading=====
8203 ====== Level 6 Heading======
8204 ======= Level 7 Heading=======
8205 ======== Level 8 Heading========
8206 ========= Level 9 Heading=========
8207 ========== Level 10 Heading==========
8208 !! result
8209 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8210 <ul>
8211 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8212 <ul>
8213 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8214 <ul>
8215 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8216 <ul>
8217 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8218 <ul>
8219 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8220 <ul>
8221 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8222 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8223 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8224 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8225 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8226 </ul>
8227 </li>
8228 </ul>
8229 </li>
8230 </ul>
8231 </li>
8232 </ul>
8233 </li>
8234 </ul>
8235 </li>
8236 </ul>
8237 </td></tr></table>
8238 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8239 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8240 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8241 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8242 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8243 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8244 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8245 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8246 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8247 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8248
8249 !! end
8250
8251 !! test
8252 TOC regression (bug 9764)
8253 !! input
8254 == title 1 ==
8255 === title 1.1 ===
8256 ==== title 1.1.1 ====
8257 === title 1.2 ===
8258 == title 2 ==
8259 === title 2.1 ===
8260 !! result
8261 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8262 <ul>
8263 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8264 <ul>
8265 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8266 <ul>
8267 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8268 </ul>
8269 </li>
8270 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8271 </ul>
8272 </li>
8273 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8274 <ul>
8275 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8276 </ul>
8277 </li>
8278 </ul>
8279 </td></tr></table>
8280 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8281 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8282 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8283 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8284 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8285 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8286
8287 !! end
8288
8289 !! test
8290 TOC with wgMaxTocLevel=3 (bug 6204)
8291 !! options
8292 wgMaxTocLevel=3
8293 !! input
8294 == title 1 ==
8295 === title 1.1 ===
8296 ==== title 1.1.1 ====
8297 === title 1.2 ===
8298 == title 2 ==
8299 === title 2.1 ===
8300 !! result
8301 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8302 <ul>
8303 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8304 <ul>
8305 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8306 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8307 </ul>
8308 </li>
8309 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8310 <ul>
8311 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8312 </ul>
8313 </li>
8314 </ul>
8315 </td></tr></table>
8316 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8317 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8318 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8319 <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8320 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8321 <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8322
8323 !! end
8324
8325 !! test
8326 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8327 !! options
8328 wgMaxTocLevel=3
8329 !! input
8330 ==Section 1==
8331 ===Section 1.1===
8332 ====Section 1.1.1====
8333 ====Section 1.1.1.1====
8334 ==Section 2==
8335 !! result
8336 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8337 <ul>
8338 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8339 <ul>
8340 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8341 </ul>
8342 </li>
8343 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8344 </ul>
8345 </td></tr></table>
8346 <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8347 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8348 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8349 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8350 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8351
8352 !! end
8353
8354
8355 !! test
8356 Resolving duplicate section names
8357 !! input
8358 == Foo bar ==
8359 == Foo bar ==
8360 !! result
8361 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8362 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8363
8364 !! end
8365
8366 !! test
8367 Resolving duplicate section names with differing case (bug 10721)
8368 !! input
8369 == Foo bar ==
8370 == Foo Bar ==
8371 !! result
8372 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8373 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8374
8375 !! end
8376
8377 !! article
8378 Template:sections
8379 !! text
8380 ===Section 1===
8381 ==Section 2==
8382 !! endarticle
8383
8384 !! test
8385 Template with sections, __NOTOC__
8386 !! input
8387 __NOTOC__
8388 ==Section 0==
8389 {{sections}}
8390 ==Section 4==
8391 !! result
8392 <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8393 <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8394 <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8395 <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8396
8397 !! end
8398
8399 !! test
8400 __NOEDITSECTION__ keyword
8401 !! input
8402 __NOEDITSECTION__
8403 ==Section 1==
8404 ==Section 2==
8405 !! result
8406 <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
8407 <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
8408
8409 !! end
8410
8411 !! test
8412 Link inside a section heading
8413 !! input
8414 ==Section with a [[Main Page|link]] in it==
8415 !! result
8416 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span></h2>
8417
8418 !! end
8419
8420 !! test
8421 TOC regression (bug 12077)
8422 !! input
8423 __TOC__
8424 == title 1 ==
8425 === title 1.1 ===
8426 == title 2 ==
8427 !! result
8428 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8429 <ul>
8430 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8431 <ul>
8432 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8433 </ul>
8434 </li>
8435 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8436 </ul>
8437 </td></tr></table>
8438 <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8439 <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8440 <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8441
8442 !! end
8443
8444 !! test
8445 BUG 1219 URL next to image (good)
8446 !! input
8447 http://example.com [[Image:foobar.jpg]]
8448 !! result
8449 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8450 </p>
8451 !!end
8452
8453 !! test
8454 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8455 !! input
8456 ===
8457 The line above must have a trailing space!
8458 === <!--
8459 --> <!-- -->
8460 But just in case it doesn't...
8461 !! result
8462 <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8463 <p>The line above must have a trailing space!
8464 </p>
8465 <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8466 <p>But just in case it doesn't...
8467 </p>
8468 !! end
8469
8470 !! test
8471 Header with special characters (bug 25462)
8472 !! input
8473 The tooltips shall not show entities to the user (ie. be double escaped)
8474
8475 == text > text ==
8476 section 1
8477
8478 == text < text ==
8479 section 2
8480
8481 == text & text ==
8482 section 3
8483
8484 == text ' text ==
8485 section 4
8486
8487 == text " text ==
8488 section 5
8489 !! result
8490 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8491 </p>
8492 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8493 <ul>
8494 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8495 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8496 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8497 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8498 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8499 </ul>
8500 </td></tr></table>
8501 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8502 <p>section 1
8503 </p>
8504 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8505 <p>section 2
8506 </p>
8507 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8508 <p>section 3
8509 </p>
8510 <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8511 <p>section 4
8512 </p>
8513 <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8514 <p>section 5
8515 </p>
8516 !! end
8517
8518 !! test
8519 Headers with excess '=' characters
8520 (Are similar tests necessary beyond the 1st level?)
8521 !! input
8522 =foo==
8523 ==foo=
8524 =''italic'' heading==
8525 ==''italic'' heading=
8526 !! result
8527 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8528 <ul>
8529 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8530 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8531 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8532 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8533 </ul>
8534 </td></tr></table>
8535 <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8536 <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8537 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8538 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8539
8540 !! end
8541
8542 !! test
8543 HTML headers vs TOC (bug 23393)
8544 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8545 !! input
8546 <h1>Header 1</h1>
8547 == Header 1.1 ==
8548 == Header 1.2 ==
8549
8550 <h1>Header 2
8551 </h1>
8552 == Header 2.1 ==
8553 == Header 2.2 ==
8554 __NOEDITSECTION__
8555 !! result
8556 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8557 <ul>
8558 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8559 <ul>
8560 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8561 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8562 </ul>
8563 </li>
8564 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8565 <ul>
8566 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8567 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8568 </ul>
8569 </li>
8570 </ul>
8571 </td></tr></table>
8572 <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
8573 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
8574 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
8575 <h1><span class="mw-headline" id="Header_2">Header 2</span></h1>
8576 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
8577 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
8578
8579 !! end
8580
8581 !! test
8582 BUG 1219 URL next to image (broken)
8583 !! input
8584 http://example.com[[Image:foobar.jpg]]
8585 !! result
8586 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8587 </p>
8588 !!end
8589
8590 !! test
8591 Bug 1186 news: in the middle of text
8592 !! input
8593 http://en.wikinews.org/wiki/Wikinews:Workplace
8594 !! result
8595 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8596 </p>
8597 !!end
8598
8599
8600 !! test
8601 Namespaced link must have a title
8602 !! input
8603 [[Project:]]
8604 !! result
8605 <p>[[Project:]]
8606 </p>
8607 !!end
8608
8609 !! test
8610 Namespaced link must have a title (bad fragment version)
8611 !! input
8612 [[Project:#fragment]]
8613 !! result
8614 <p>[[Project:#fragment]]
8615 </p>
8616 !!end
8617
8618
8619 ###
8620 ### HTML tags and HTML attributes
8621 ###
8622
8623 !! test
8624 div with no attributes
8625 !! input
8626 <div>HTML rocks</div>
8627 !! result
8628 <div>HTML rocks</div>
8629
8630 !! end
8631
8632 !! test
8633 div with double-quoted attribute
8634 !! input
8635 <div id="rock">HTML rocks</div>
8636 !! result
8637 <div id="rock">HTML rocks</div>
8638
8639 !! end
8640
8641 !! test
8642 div with single-quoted attribute
8643 !! input
8644 <div id='rock'>HTML rocks</div>
8645 !! result
8646 <div id="rock">HTML rocks</div>
8647
8648 !! end
8649
8650 !! test
8651 div with unquoted attribute
8652 !! input
8653 <div id=rock>HTML rocks</div>
8654 !! result
8655 <div id="rock">HTML rocks</div>
8656
8657 !! end
8658
8659 !! test
8660 div with illegal double attributes
8661 !! input
8662 <div id="a" id="b">HTML rocks</div>
8663 !! result
8664 <div id="b">HTML rocks</div>
8665
8666 !!end
8667
8668 # FIXME: produce empty string instead of "class" in the PHP parser, following
8669 # the HTML5 spec.
8670 !! test
8671 div with empty attribute value, space before equals
8672 !! options
8673 parsoid
8674 !! input
8675 <div class =>HTML rocks</div>
8676 !! result
8677 <div class="">HTML rocks</div>
8678
8679 !! end
8680
8681 # The PHP parser escapes the opening brace to &#123; for some reason, so
8682 # disabled this test for it.
8683 !! test
8684 div with braces in attribute value
8685 !! options
8686 parsoid
8687 !! input
8688 <div title="{}">Foo</div>
8689 !! result
8690 <div title="{}">Foo</div>
8691 !! end
8692
8693 # This it very inconsistent in the PHP parser: it returns
8694 # class="class" if there is a space between the name and the equal sign (see
8695 # 'div with empty attribute value, space before equals'), but strips the
8696 # attribute completely if the space is missing. We hope that not much content
8697 # depends on this, so are implementing the behavior below in Parsoid for
8698 # consistencies' sake. Disabled for the PHP parser.
8699 # FIXME: fix this behavior in the PHP parser?
8700 !! test
8701 div with empty attribute value, no space before equals
8702 !! options
8703 parsoid
8704 !! input
8705 <div class=>HTML rocks</div>
8706 !! result
8707 <div class="">HTML rocks</div>
8708
8709 !! end
8710
8711 !! test
8712 HTML multiple attributes correction
8713 !! input
8714 <p class="error" class="awesome">Awesome!</p>
8715 !! result
8716 <p class="awesome">Awesome!</p>
8717
8718 !!end
8719
8720 !! test
8721 Table multiple attributes correction
8722 !! input
8723 {|
8724 !+ class="error" class="awesome"| status
8725 |}
8726 !! result
8727 <table>
8728 <tr>
8729 <th class="awesome"> status
8730 </th></tr></table>
8731
8732 !!end
8733
8734 !! test
8735 DIV IN UPPERCASE
8736 !! input
8737 <DIV ID="x">HTML ROCKS</DIV>
8738 !! result
8739 <div id="x">HTML ROCKS</div>
8740
8741 !!end
8742
8743 !! test
8744 Non-ASCII pseudo-tags are rendered as text
8745 !! input
8746 <khyô>
8747 !! result
8748 <p>&lt;khyô&gt;
8749 </p>
8750 !! end
8751
8752 !! test
8753 Pseudo-tag with URL 'name' renders as url link
8754 !! input
8755 <http://example.com/>
8756 !! result
8757 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8758 </p>
8759 !! end
8760
8761 !! test
8762 text with amp in the middle of nowhere
8763 !! input
8764 Remember AT&T?
8765 !!result
8766 <p>Remember AT&amp;T?
8767 </p>
8768 !! end
8769
8770 !! test
8771 text with character entity: eacute
8772 !! input
8773 I always thought &eacute; was a cute letter.
8774 !! result
8775 <p>I always thought &#233; was a cute letter.
8776 </p>
8777 !! end
8778
8779 !! test
8780 text with entity-escaped character entity-like string: eacute
8781 !! input
8782 I always thought &amp;eacute; was a cute letter.
8783 !! result
8784 <p>I always thought &amp;eacute; was a cute letter.
8785 </p>
8786 !! end
8787
8788 !! test
8789 text with undefined character entity: xacute
8790 !! input
8791 I always thought &xacute; was a cute letter.
8792 !! result
8793 <p>I always thought &amp;xacute; was a cute letter.
8794 </p>
8795 !! end
8796
8797
8798 ###
8799 ### Media links
8800 ###
8801
8802 !! test
8803 Media link
8804 !! input
8805 [[Media:Foobar.jpg]]
8806 !! result
8807 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8808 </p>
8809 !! end
8810
8811 !! test
8812 Media link with text
8813 !! input
8814 [[Media:Foobar.jpg|A neat file to look at]]
8815 !! result
8816 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8817 </p>
8818 !! end
8819
8820 # FIXME: this is still bad HTML tag nesting
8821 !! test
8822 Media link with nasty text
8823 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8824 !! input
8825 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8826 !! result
8827 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8828
8829 !! end
8830
8831 !! test
8832 Media link to nonexistent file (bug 1702)
8833 !! input
8834 [[Media:No such.jpg]]
8835 !! result
8836 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8837 </p>
8838 !! end
8839
8840 !! test
8841 Image link to nonexistent file (bug 1850 - good)
8842 !! input
8843 [[Image:No such.jpg]]
8844 !! result
8845 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8846 </p>
8847 !! end
8848
8849 !! test
8850 :Image link to nonexistent file (bug 1850 - bad)
8851 !! input
8852 [[:Image:No such.jpg]]
8853 !! result
8854 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8855 </p>
8856 !! end
8857
8858
8859
8860 !! test
8861 Character reference normalization in link text (bug 1938)
8862 !! input
8863 [[Main Page|this&that]]
8864 !! result
8865 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8866 </p>
8867 !!end
8868
8869 !! article
8870 אַ
8871 !! text
8872 Test for unicode normalization
8873
8874 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8875 !! endarticle
8876
8877 !! test
8878 (bug 19451) Links should refer to the normalized form.
8879 !! input
8880 [[&#xFB2E;]]
8881 [[&#x5d0;&#x5b7;]]
8882 [[&#x5d0;ַ]]
8883 [[א&#x5b7;]]
8884 [[אַ]]
8885 !! result
8886 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8887 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8888 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8889 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8890 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8891 </p>
8892 !! end
8893
8894 !! test
8895 Empty attribute crash test (bug 2067)
8896 !! input
8897 <font color="">foo</font>
8898 !! result
8899 <p><font color="">foo</font>
8900 </p>
8901 !! end
8902
8903 !! test
8904 Empty attribute crash test single-quotes (bug 2067)
8905 !! input
8906 <font color=''>foo</font>
8907 !! result
8908 <p><font color="">foo</font>
8909 </p>
8910 !! end
8911
8912 !! test
8913 Attribute test: equals, then nothing
8914 !! input
8915 <font color=>foo</font>
8916 !! result
8917 <p><font>foo</font>
8918 </p>
8919 !! end
8920
8921 !! test
8922 Attribute test: unquoted value
8923 !! input
8924 <font color=x>foo</font>
8925 !! result
8926 <p><font color="x">foo</font>
8927 </p>
8928 !! end
8929
8930 !! test
8931 Attribute test: unquoted but illegal value (hash)
8932 !! input
8933 <font color=#x>foo</font>
8934 !! result
8935 <p><font color="#x">foo</font>
8936 </p>
8937 !! end
8938
8939 !! test
8940 Attribute test: no value
8941 !! input
8942 <font color>foo</font>
8943 !! result
8944 <p><font color="color">foo</font>
8945 </p>
8946 !! end
8947
8948 !! test
8949 Bug 2095: link with three closing brackets
8950 !! input
8951 [[Main Page]]]
8952 !! result
8953 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8954 </p>
8955 !! end
8956
8957 !! test
8958 Bug 2095: link with pipe and three closing brackets
8959 !! input
8960 [[Main Page|link]]]
8961 !! result
8962 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8963 </p>
8964 !! end
8965
8966 !! test
8967 Bug 2095: link with pipe and three closing brackets, version 2
8968 !! input
8969 [[Main Page|[http://example.com/]]]
8970 !! result
8971 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8972 </p>
8973 !! end
8974
8975
8976 ###
8977 ### Safety
8978 ###
8979
8980 !! article
8981 Template:Dangerous attribute
8982 !! text
8983 " onmouseover="alert(document.cookie)
8984 !! endarticle
8985
8986 !! article
8987 Template:Dangerous style attribute
8988 !! text
8989 border-size: expression(alert(document.cookie))
8990 !! endarticle
8991
8992 !! article
8993 Template:Div style
8994 !! text
8995 <div style="float: right; {{{1}}}">Magic div</div>
8996 !! endarticle
8997
8998 !! test
8999 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
9000 !! input
9001 <div title="{{test}}"></div>
9002 !! result
9003 <div title="This is a test template"></div>
9004
9005 !! end
9006
9007 !! test
9008 Bug 2304: HTML attribute safety (dangerous template; 2309)
9009 !! input
9010 <div title="{{dangerous attribute}}"></div>
9011 !! result
9012 <div title=""></div>
9013
9014 !! end
9015
9016 !! test
9017 Bug 2304: HTML attribute safety (dangerous style template; 2309)
9018 !! input
9019 <div style="{{dangerous style attribute}}"></div>
9020 !! result
9021 <div style="/* insecure input */"></div>
9022
9023 !! end
9024
9025 !! test
9026 Bug 2304: HTML attribute safety (safe parameter; 2309)
9027 !! input
9028 {{div style|width: 200px}}
9029 !! result
9030 <div style="float: right; width: 200px">Magic div</div>
9031
9032 !! end
9033
9034 !! test
9035 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
9036 !! input
9037 {{div style|width: expression(alert(document.cookie))}}
9038 !! result
9039 <div style="/* insecure input */">Magic div</div>
9040
9041 !! end
9042
9043 !! test
9044 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9045 !! input
9046 {{div style|"><script>alert(document.cookie)</script>}}
9047 !! result
9048 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9049
9050 !! end
9051
9052 !! test
9053 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9054 !! input
9055 {{div style|" ><script>alert(document.cookie)</script>}}
9056 !! result
9057 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9058
9059 !! end
9060
9061 !! test
9062 Bug 2304: HTML attribute safety (link)
9063 !! input
9064 <div title="[[Main Page]]"></div>
9065 !! result
9066 <div title="&#91;&#91;Main Page]]"></div>
9067
9068 !! end
9069
9070 !! test
9071 Bug 2304: HTML attribute safety (italics)
9072 !! input
9073 <div title="''foobar''"></div>
9074 !! result
9075 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9076
9077 !! end
9078
9079 !! test
9080 Bug 2304: HTML attribute safety (bold)
9081 !! input
9082 <div title="'''foobar'''"></div>
9083 !! result
9084 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9085
9086 !! end
9087
9088
9089 !! test
9090 Bug 2304: HTML attribute safety (ISBN)
9091 !! input
9092 <div title="ISBN 1234567890"></div>
9093 !! result
9094 <div title="&#73;SBN 1234567890"></div>
9095
9096 !! end
9097
9098 !! test
9099 Bug 2304: HTML attribute safety (RFC)
9100 !! input
9101 <div title="RFC 1234"></div>
9102 !! result
9103 <div title="&#82;FC 1234"></div>
9104
9105 !! end
9106
9107 !! test
9108 Bug 2304: HTML attribute safety (PMID)
9109 !! input
9110 <div title="PMID 1234567890"></div>
9111 !! result
9112 <div title="&#80;MID 1234567890"></div>
9113
9114 !! end
9115
9116 !! test
9117 Bug 2304: HTML attribute safety (web link)
9118 !! input
9119 <div title="http://example.com/"></div>
9120 !! result
9121 <div title="http&#58;//example.com/"></div>
9122
9123 !! end
9124
9125 !! test
9126 Bug 2304: HTML attribute safety (named web link)
9127 !! input
9128 <div title="[http://example.com/ link]"></div>
9129 !! result
9130 <div title="&#91;http&#58;//example.com/ link]"></div>
9131
9132 !! end
9133
9134 !! test
9135 Bug 3244: HTML attribute safety (extension; safe)
9136 !! input
9137 <div style="<nowiki>background:blue</nowiki>"></div>
9138 !! result
9139 <div style="background:blue"></div>
9140
9141 !! end
9142
9143 !! test
9144 Bug 3244: HTML attribute safety (extension; unsafe)
9145 !! input
9146 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9147 !! result
9148 <div style="/* insecure input */"></div>
9149
9150 !! end
9151
9152 # More MSIE fun discovered by Tom Gilder
9153
9154 !! test
9155 MSIE CSS safety test: spurious slash
9156 !! input
9157 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9158 !! result
9159 <div style="/* insecure input */">evil</div>
9160
9161 !! end
9162
9163 !! test
9164 MSIE CSS safety test: hex code
9165 !! input
9166 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9167 !! result
9168 <div style="/* insecure input */">evil</div>
9169
9170 !! end
9171
9172 !! test
9173 MSIE CSS safety test: comment in url
9174 !! input
9175 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9176 !! result
9177 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9178
9179 !! end
9180
9181 !! test
9182 MSIE CSS safety test: comment in expression
9183 !! input
9184 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9185 !! result
9186 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9187
9188 !! end
9189
9190
9191 !! test
9192 Table attribute legitimate extension
9193 !! input
9194 {|
9195 !+ style="<nowiki>color:blue</nowiki>"| status
9196 |}
9197 !! result
9198 <table>
9199 <tr>
9200 <th style="color:blue"> status
9201 </th></tr></table>
9202
9203 !!end
9204
9205 !! test
9206 Table attribute safety
9207 !! input
9208 {|
9209 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9210 |}
9211 !! result
9212 <table>
9213 <tr>
9214 <th style="/* insecure input */"> status
9215 </th></tr></table>
9216
9217 !! end
9218
9219 !! test
9220 CSS line continuation 1
9221 !! input
9222 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9223 !! result
9224 <div style="/* insecure input */"></div>
9225
9226 !! end
9227
9228 !! test
9229 CSS line continuation 2
9230 !! input
9231 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9232 !! result
9233 <div style="/* insecure input */"></div>
9234
9235 !! end
9236
9237 !! article
9238 Template:Identity
9239 !! text
9240 {{{1}}}
9241 !! endarticle
9242
9243 !! test
9244 Expansion of multi-line templates in attribute values (bug 6255)
9245 !! input
9246 <div style="background: {{identity|#00FF00}}">-</div>
9247 !! result
9248 <div style="background: #00FF00">-</div>
9249
9250 !! end
9251
9252
9253 !! test
9254 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9255 !! input
9256 <div style="background:
9257 #00FF00">-</div>
9258 !! result
9259 <div style="background: #00FF00">-</div>
9260
9261 !! end
9262
9263 !! test
9264 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9265 !! input
9266 <div style="background: &#10;#00FF00">-</div>
9267 !! result
9268 <div style="background: &#10;#00FF00">-</div>
9269
9270 !! end
9271
9272 ###
9273 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9274 ###
9275 !! test
9276 Parser hook: empty input
9277 !! input
9278 <tag></tag>
9279 !! result
9280 <pre>
9281 ''
9282 array (
9283 )
9284 </pre>
9285
9286 !! end
9287
9288 !! test
9289 Parser hook: empty input using terminated empty elements
9290 !! input
9291 <tag/>
9292 !! result
9293 <pre>
9294 NULL
9295 array (
9296 )
9297 </pre>
9298
9299 !! end
9300
9301 !! test
9302 Parser hook: empty input using terminated empty elements (space before)
9303 !! input
9304 <tag />
9305 !! result
9306 <pre>
9307 NULL
9308 array (
9309 )
9310 </pre>
9311
9312 !! end
9313
9314 !! test
9315 Parser hook: basic input
9316 !! input
9317 <tag>input</tag>
9318 !! result
9319 <pre>
9320 'input'
9321 array (
9322 )
9323 </pre>
9324
9325 !! end
9326
9327
9328 !! test
9329 Parser hook: case insensitive
9330 !! input
9331 <TAG>input</TAG>
9332 !! result
9333 <pre>
9334 'input'
9335 array (
9336 )
9337 </pre>
9338
9339 !! end
9340
9341
9342 !! test
9343 Parser hook: case insensitive, redux
9344 !! input
9345 <TaG>input</TAg>
9346 !! result
9347 <pre>
9348 'input'
9349 array (
9350 )
9351 </pre>
9352
9353 !! end
9354
9355 !! test
9356 Parser hook: nested tags
9357 !! options
9358 noxml
9359 !! input
9360 <tag><tag></tag></tag>
9361 !! result
9362 <pre>
9363 '<tag>'
9364 array (
9365 )
9366 </pre>&lt;/tag&gt;
9367
9368 !! end
9369
9370 !! test
9371 Parser hook: basic arguments
9372 !! input
9373 <tag width=200 height = "100" depth = '50' square></tag>
9374 !! result
9375 <pre>
9376 ''
9377 array (
9378 'width' => '200',
9379 'height' => '100',
9380 'depth' => '50',
9381 'square' => 'square',
9382 )
9383 </pre>
9384
9385 !! end
9386
9387 !! test
9388 Parser hook: argument containing a forward slash (bug 5344)
9389 !! input
9390 <tag filename='/tmp/bla'></tag>
9391 !! result
9392 <pre>
9393 ''
9394 array (
9395 'filename' => '/tmp/bla',
9396 )
9397 </pre>
9398
9399 !! end
9400
9401 !! test
9402 Parser hook: empty input using terminated empty elements (bug 2374)
9403 !! input
9404 <tag foo=bar/>text
9405 !! result
9406 <pre>
9407 NULL
9408 array (
9409 'foo' => 'bar',
9410 )
9411 </pre>text
9412
9413 !! end
9414
9415 # </tag> should be output literally since there is no matching tag that begins it
9416 !! test
9417 Parser hook: basic arguments using terminated empty elements (bug 2374)
9418 !! input
9419 <tag width=200 height = "100" depth = '50' square/>
9420 other stuff
9421 </tag>
9422 !! result
9423 <pre>
9424 NULL
9425 array (
9426 'width' => '200',
9427 'height' => '100',
9428 'depth' => '50',
9429 'square' => 'square',
9430 )
9431 </pre>
9432 <p>other stuff
9433 &lt;/tag&gt;
9434 </p>
9435 !! end
9436
9437 ###
9438 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9439 ###
9440
9441 !! test
9442 Parser hook: static parser hook not inside a comment
9443 !! input
9444 <statictag>hello, world</statictag>
9445 <statictag action=flush/>
9446 !! result
9447 <p>hello, world
9448 </p>
9449 !! end
9450
9451
9452 !! test
9453 Parser hook: static parser hook inside a comment
9454 !! input
9455 <!-- <statictag>hello, world</statictag> -->
9456 <statictag action=flush/>
9457 !! result
9458 <p><br />
9459 </p>
9460 !! end
9461
9462 # Nested template calls; this case was broken by Parser.php rev 1.506,
9463 # since reverted.
9464
9465 !! article
9466 Template:One-parameter
9467 !! text
9468 (My parameter is: {{{1}}})
9469 !! endarticle
9470
9471 !! article
9472 Template:Map-one-parameter
9473 !! text
9474 {{{{{1}}}|{{{2}}}}}
9475 !! endarticle
9476
9477 !! test
9478 Nested template calls
9479 !! input
9480 {{Map-one-parameter|One-parameter|param}}
9481 !! result
9482 <p>(My parameter is: param)
9483 </p>
9484 !! end
9485
9486
9487 ###
9488 ### Sanitizer
9489 ###
9490 !! test
9491 Sanitizer: Closing of open tags
9492 !! input
9493 <s></s><table></table>
9494 !! result
9495 <s></s><table></table>
9496
9497 !! end
9498
9499 !! test
9500 Sanitizer: Closing of open but not closed tags
9501 !! input
9502 <s>foo
9503 !! result
9504 <p><s>foo</s>
9505 </p>
9506 !! end
9507
9508 !! test
9509 Sanitizer: Closing of closed but not open tags
9510 !! input
9511 </s>
9512 !! result
9513 <p>&lt;/s&gt;
9514 </p>
9515 !! end
9516
9517 !! test
9518 Sanitizer: Closing of closed but not open table tags
9519 !! input
9520 Table not started</td></tr></table>
9521 !! result
9522 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9523 </p>
9524 !! end
9525
9526 !! test
9527 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9528 !! input
9529 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9530 !! result
9531 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9532 </p>
9533 !! end
9534
9535 !! test
9536 Sanitizer: Validating the contents of the id attribute (bug 4515)
9537 !! options
9538 disabled
9539 !! input
9540 <br id=9 />
9541 !! result
9542 Something, but definitely not <br id="9" />...
9543 !! end
9544
9545 !! test
9546 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9547 !! options
9548 disabled
9549 !! input
9550 <br id="foo" /><br id="foo" />
9551 !! result
9552 Something need to be done. foo-2 ?
9553 !! end
9554
9555 !! test
9556 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9557 !! input
9558 <div itemscope>
9559 <meta itemprop="hello" content="world">
9560 <meta http-equiv="refresh" content="5">
9561 <meta itemprop="hello" http-equiv="refresh" content="5">
9562 <link itemprop="hello" href="{{SERVER}}">
9563 <link rel="stylesheet" href="{{SERVER}}">
9564 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9565 </div>
9566 !! result
9567 <div itemscope="itemscope">
9568 <p> <meta itemprop="hello" content="world" />
9569 &lt;meta http-equiv="refresh" content="5"&gt;
9570 <meta itemprop="hello" content="5" />
9571 </p>
9572 <link itemprop="hello" href="http&#58;//example.org" />
9573 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9574 <link itemprop="hello" href="http&#58;//example.org" />
9575 </div>
9576
9577 !! end
9578
9579 !! test
9580 Language converter: output gets cut off unexpectedly (bug 5757)
9581 !! options
9582 language=zh
9583 !! input
9584 this bit is safe: }-
9585
9586 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9587
9588 then we get cut off here: }-
9589
9590 all additional text is vanished
9591 !! result
9592 <p>this bit is safe: }-
9593 </p><p>but if we add a conversion instance: xxx
9594 </p><p>then we get cut off here: }-
9595 </p><p>all additional text is vanished
9596 </p>
9597 !! end
9598
9599 !! test
9600 Self closed html pairs (bug 5487)
9601 !! options
9602 !! input
9603 <center><font id="bug" />Centered text</center>
9604 <div><font id="bug2" />In div text</div>
9605 !! result
9606 <center>&lt;font id="bug" /&gt;Centered text</center>
9607 <div>&lt;font id="bug2" /&gt;In div text</div>
9608
9609 !! end
9610
9611 #
9612 #
9613 #
9614
9615 !! test
9616 Punctuation: nbsp before exclamation
9617 !! input
9618 C'est grave !
9619 !! result
9620 <p>C'est grave&#160;!
9621 </p>
9622 !! end
9623
9624 !! test
9625 Punctuation: CSS !important (bug 11874)
9626 !! input
9627 <div style="width:50% !important">important</div>
9628 !! result
9629 <div style="width:50% !important">important</div>
9630
9631 !!end
9632
9633 !! test
9634 Punctuation: CSS ! important (bug 11874; with space after)
9635 !! input
9636 <div style="width:50% ! important">important</div>
9637 !! result
9638 <div style="width:50% ! important">important</div>
9639
9640 !!end
9641
9642
9643 !! test
9644 HTML bullet list, closed tags (bug 5497)
9645 !! input
9646 <ul>
9647 <li>One</li>
9648 <li>Two</li>
9649 </ul>
9650 !! result
9651 <ul>
9652 <li>One</li>
9653 <li>Two</li>
9654 </ul>
9655
9656 !! end
9657
9658 !! test
9659 HTML bullet list, unclosed tags (bug 5497)
9660 !! options
9661 disabled
9662 !! input
9663 <ul>
9664 <li>One
9665 <li>Two
9666 </ul>
9667 !! result
9668 <ul>
9669 <li>One
9670 </li><li>Two
9671 </li></ul>
9672
9673 !! end
9674
9675 !! test
9676 HTML ordered list, closed tags (bug 5497)
9677 !! input
9678 <ol>
9679 <li>One</li>
9680 <li>Two</li>
9681 </ol>
9682 !! result
9683 <ol>
9684 <li>One</li>
9685 <li>Two</li>
9686 </ol>
9687
9688 !! end
9689
9690 !! test
9691 HTML ordered list, unclosed tags (bug 5497)
9692 !! options
9693 disabled
9694 !! input
9695 <ol>
9696 <li>One
9697 <li>Two
9698 </ol>
9699 !! result
9700 <ol>
9701 <li>One
9702 </li><li>Two
9703 </li></ol>
9704
9705 !! end
9706
9707 !! test
9708 HTML nested bullet list, closed tags (bug 5497)
9709 !! input
9710 <ul>
9711 <li>One</li>
9712 <li>Two:
9713 <ul>
9714 <li>Sub-one</li>
9715 <li>Sub-two</li>
9716 </ul>
9717 </li>
9718 </ul>
9719 !! result
9720 <ul>
9721 <li>One</li>
9722 <li>Two:
9723 <ul>
9724 <li>Sub-one</li>
9725 <li>Sub-two</li>
9726 </ul>
9727 </li>
9728 </ul>
9729
9730 !! end
9731
9732 !! test
9733 HTML nested bullet list, open tags (bug 5497)
9734 !! options
9735 disabled
9736 !! input
9737 <ul>
9738 <li>One
9739 <li>Two:
9740 <ul>
9741 <li>Sub-one
9742 <li>Sub-two
9743 </ul>
9744 </ul>
9745 !! result
9746 <ul>
9747 <li>One
9748 </li><li>Two:
9749 <ul>
9750 <li>Sub-one
9751 </li><li>Sub-two
9752 </li></ul>
9753 </li></ul>
9754
9755 !! end
9756
9757 !! test
9758 HTML nested ordered list, closed tags (bug 5497)
9759 !! input
9760 <ol>
9761 <li>One</li>
9762 <li>Two:
9763 <ol>
9764 <li>Sub-one</li>
9765 <li>Sub-two</li>
9766 </ol>
9767 </li>
9768 </ol>
9769 !! result
9770 <ol>
9771 <li>One</li>
9772 <li>Two:
9773 <ol>
9774 <li>Sub-one</li>
9775 <li>Sub-two</li>
9776 </ol>
9777 </li>
9778 </ol>
9779
9780 !! end
9781
9782 !! test
9783 HTML nested ordered list, open tags (bug 5497)
9784 !! options
9785 disabled
9786 !! input
9787 <ol>
9788 <li>One
9789 <li>Two:
9790 <ol>
9791 <li>Sub-one
9792 <li>Sub-two
9793 </ol>
9794 </ol>
9795 !! result
9796 <ol>
9797 <li>One
9798 </li><li>Two:
9799 <ol>
9800 <li>Sub-one
9801 </li><li>Sub-two
9802 </li></ol>
9803 </li></ol>
9804
9805 !! end
9806
9807 !! test
9808 HTML ordered list item with parameters oddity
9809 !! input
9810 <ol><li id="fragment">One</li></ol>
9811 !! result
9812 <ol><li id="fragment">One</li></ol>
9813
9814 !! end
9815
9816 !!test
9817 bug 5918: autonumbering
9818 !! input
9819 [http://first/] [http://second] [ftp://ftp]
9820
9821 ftp://inlineftp
9822
9823 [mailto:enclosed@mail.tld With target]
9824
9825 [mailto:enclosed@mail.tld]
9826
9827 mailto:inline@mail.tld
9828 !! result
9829 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9830 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9831 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9832 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9833 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9834 </p>
9835 !! end
9836
9837
9838 #
9839 # Security and HTML correctness
9840 # From Nick Jenkins' fuzz testing
9841 #
9842
9843 !! test
9844 Fuzz testing: Parser13
9845 !! input
9846 {|
9847 | http://a|
9848 !! result
9849 <table>
9850 <tr>
9851 <td>
9852 </td>
9853 </tr>
9854 </table>
9855
9856 !! end
9857
9858 !! test
9859 Fuzz testing: Parser14
9860 !! input
9861 == onmouseover= ==
9862 http://__TOC__
9863 !! result
9864 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
9865 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9866 <ul>
9867 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9868 </ul>
9869 </td></tr></table>
9870
9871 !! end
9872
9873 !! test
9874 Fuzz testing: Parser14-table
9875 !! input
9876 ==a==
9877 {| STYLE=__TOC__
9878 !! result
9879 <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
9880 <table style="&#95;_TOC&#95;_">
9881 <tr><td></td></tr>
9882 </table>
9883
9884 !! end
9885
9886 # Known to produce bogus xml (extra </td>)
9887 !! test
9888 Fuzz testing: Parser16
9889 !! options
9890 noxml
9891 !! input
9892 {|
9893 !https://||||||
9894 !! result
9895 <table>
9896 <tr>
9897 <th>https://</th>
9898 <th></th>
9899 <th></th>
9900 <th>
9901 </td>
9902 </tr>
9903 </table>
9904
9905 !! end
9906
9907 !! test
9908 Fuzz testing: Parser21
9909 !! input
9910 {|
9911 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9912 |
9913 !! result
9914 <table>
9915 <tr>
9916 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9917 </th>
9918 <td>
9919 </td>
9920 </tr>
9921 </table>
9922
9923 !! end
9924
9925 !! test
9926 Fuzz testing: Parser22
9927 !! input
9928 http://===r:::https://b
9929
9930 {|
9931 !!result
9932 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9933 </p>
9934 <table>
9935 <tr><td></td></tr>
9936 </table>
9937
9938 !! end
9939
9940 # Known to produce bad XML for now
9941 !! test
9942 Fuzz testing: Parser24
9943 !! options
9944 noxml
9945 !! input
9946 {|
9947 {{{|
9948 <u CLASS=
9949 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9950 <br style="onmouseover='alert(document.cookie);' " />
9951
9952 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9953 |
9954 !! result
9955 <table>
9956 {{{|
9957 <u class="&#124;">}}}} &gt;
9958 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9959
9960 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9961 <tr>
9962 <td></u>
9963 </td>
9964 </tr>
9965 </table>
9966
9967 !! end
9968
9969 # Note: the current result listed for this is not what the original one was,
9970 # but the original bug was JavaScript injection, which is fixed in any case.
9971 # It's not clear that the original result listed was any more correct than the
9972 # current one. Original result:
9973 # <p>{{{|
9974 # </p>
9975 # <li class="&#124;&#124;">
9976 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9977 !!test
9978 Fuzz testing: Parser25 (bug 6055)
9979 !! input
9980 {{{
9981 |
9982 <LI CLASS=||
9983 >
9984 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9985 !! result
9986 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9987 </p>
9988 !! end
9989
9990 !!test
9991 Fuzz testing: URL adjacent extension (with space, clean)
9992 !! options
9993 !! input
9994 http://example.com <nowiki>junk</nowiki>
9995 !! result
9996 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9997 </p>
9998 !!end
9999
10000 !!test
10001 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
10002 !! options
10003 !! input
10004 http://example.com<nowiki>junk</nowiki>
10005 !! result
10006 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
10007 </p>
10008 !!end
10009
10010 !!test
10011 Fuzz testing: URL adjacent extension (no space, dirty; pre)
10012 !! options
10013 !! input
10014 http://example.com<pre>junk</pre>
10015 !! result
10016 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
10017
10018 !!end
10019
10020 !!test
10021 Fuzz testing: image with bogus manual thumbnail
10022 !!input
10023 [[Image:foobar.jpg|thumbnail= ]]
10024 !!result
10025 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
10026
10027 !!end
10028
10029 !! test
10030 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
10031 !! input
10032 <pre dir="&#10;"></pre>
10033 !! result
10034 <pre dir="&#10;"></pre>
10035
10036 !! end
10037
10038 !! test
10039 Parsing optional HTML elements (Bug 6171)
10040 !! options
10041 !! input
10042 <table>
10043 <tr>
10044 <td> Some tabular data</td>
10045 <td> More tabular data ...
10046 <td> And yet som tabular data</td>
10047 </tr>
10048 </table>
10049 !! result
10050 <table>
10051 <tr>
10052 <td> Some tabular data</td>
10053 <td> More tabular data ...
10054 </td><td> And yet som tabular data</td>
10055 </tr>
10056 </table>
10057
10058 !! end
10059
10060 !! test
10061 Correct handling of <td>, <tr> (Bug 6171)
10062 !! options
10063 !! input
10064 <table>
10065 <tr>
10066 <td> Some tabular data</td>
10067 <td> More tabular data ...</td>
10068 <td> And yet som tabular data</td>
10069 </tr>
10070 </table>
10071 !! result
10072 <table>
10073 <tr>
10074 <td> Some tabular data</td>
10075 <td> More tabular data ...</td>
10076 <td> And yet som tabular data</td>
10077 </tr>
10078 </table>
10079
10080 !! end
10081
10082
10083 !! test
10084 Parsing crashing regression (fr:JavaScript)
10085 !! input
10086 </body></x>
10087 !! result
10088 <p>&lt;/body&gt;&lt;/x&gt;
10089 </p>
10090 !! end
10091
10092 !! test
10093 Inline wiki vs wiki block nesting
10094 !! input
10095 '''Bold paragraph
10096
10097 New wiki paragraph
10098 !! result
10099 <p><b>Bold paragraph</b>
10100 </p><p>New wiki paragraph
10101 </p>
10102 !! end
10103
10104 !! test
10105 Inline HTML vs wiki block nesting
10106 !! options
10107 disabled
10108 !! input
10109 <b>Bold paragraph
10110
10111 New wiki paragraph
10112 !! result
10113 <p><b>Bold paragraph</b>
10114 </p><p>New wiki paragraph
10115 </p>
10116 !! end
10117
10118 # Original result was this:
10119 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10120 # </p>
10121 # While that might be marginally more intuitive, maybe, the six-apostrophe
10122 # construct is clearly pathological and the result stated here (which is what
10123 # the parser actually does) is about as reasonable as anything.
10124 !!test
10125 Mixing markup for italics and bold
10126 !! options
10127 !! input
10128 '''bold''''''bold''bolditalics'''''
10129 !! result
10130 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10131 </p>
10132 !! end
10133
10134
10135 !! article
10136 Xyzzyx
10137 !! text
10138 Article for special page transclusion test
10139 !! endarticle
10140
10141 !! test
10142 Special page transclusion
10143 !! options
10144 !! input
10145 {{Special:Prefixindex/Xyzzyx}}
10146 !! result
10147 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10148
10149 !! end
10150
10151 !! test
10152 Special page transclusion twice (bug 5021)
10153 !! options
10154 !! input
10155 {{Special:Prefixindex/Xyzzyx}}
10156 {{Special:Prefixindex/Xyzzyx}}
10157 !! result
10158 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10159 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10160
10161 !! end
10162
10163 !! test
10164 Transclusion of default MediaWiki message
10165 !! input
10166 {{MediaWiki:Mainpage}}
10167 !!result
10168 <p>Main Page
10169 </p>
10170 !! end
10171
10172 !! test
10173 Transclusion of nonexistent MediaWiki message
10174 !! input
10175 {{MediaWiki:Mainpagexxx}}
10176 !!result
10177 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10178 </p>
10179 !! end
10180
10181 !! test
10182 Transclusion of MediaWiki message with underscore
10183 !! input
10184 {{MediaWiki:history_short}}
10185 !! result
10186 <p>History
10187 </p>
10188 !! end
10189
10190 !! test
10191 Transclusion of MediaWiki message with space
10192 !! input
10193 {{MediaWiki:history short}}
10194 !! result
10195 <p>History
10196 </p>
10197 !! end
10198
10199 !! test
10200 Invalid header with following text
10201 !! input
10202 = x = y
10203 !! result
10204 <p>= x = y
10205 </p>
10206 !! end
10207
10208
10209 !! test
10210 Section extraction test (section 0)
10211 !! options
10212 section=0
10213 !! input
10214 start
10215 ==a==
10216 ===aa===
10217 ====aaa====
10218 ==b==
10219 ===ba===
10220 ===bb===
10221 ====bba====
10222 ===bc===
10223 ==c==
10224 ===ca===
10225 !! result
10226 start
10227 !! end
10228
10229 !! test
10230 Section extraction test (section 1)
10231 !! options
10232 section=1
10233 !! input
10234 start
10235 ==a==
10236 ===aa===
10237 ====aaa====
10238 ==b==
10239 ===ba===
10240 ===bb===
10241 ====bba====
10242 ===bc===
10243 ==c==
10244 ===ca===
10245 !! result
10246 ==a==
10247 ===aa===
10248 ====aaa====
10249 !! end
10250
10251 !! test
10252 Section extraction test (section 2)
10253 !! options
10254 section=2
10255 !! input
10256 start
10257 ==a==
10258 ===aa===
10259 ====aaa====
10260 ==b==
10261 ===ba===
10262 ===bb===
10263 ====bba====
10264 ===bc===
10265 ==c==
10266 ===ca===
10267 !! result
10268 ===aa===
10269 ====aaa====
10270 !! end
10271
10272 !! test
10273 Section extraction test (section 3)
10274 !! options
10275 section=3
10276 !! input
10277 start
10278 ==a==
10279 ===aa===
10280 ====aaa====
10281 ==b==
10282 ===ba===
10283 ===bb===
10284 ====bba====
10285 ===bc===
10286 ==c==
10287 ===ca===
10288 !! result
10289 ====aaa====
10290 !! end
10291
10292 !! test
10293 Section extraction test (section 4)
10294 !! options
10295 section=4
10296 !! input
10297 start
10298 ==a==
10299 ===aa===
10300 ====aaa====
10301 ==b==
10302 ===ba===
10303 ===bb===
10304 ====bba====
10305 ===bc===
10306 ==c==
10307 ===ca===
10308 !! result
10309 ==b==
10310 ===ba===
10311 ===bb===
10312 ====bba====
10313 ===bc===
10314 !! end
10315
10316 !! test
10317 Section extraction test (section 5)
10318 !! options
10319 section=5
10320 !! input
10321 start
10322 ==a==
10323 ===aa===
10324 ====aaa====
10325 ==b==
10326 ===ba===
10327 ===bb===
10328 ====bba====
10329 ===bc===
10330 ==c==
10331 ===ca===
10332 !! result
10333 ===ba===
10334 !! end
10335
10336 !! test
10337 Section extraction test (section 6)
10338 !! options
10339 section=6
10340 !! input
10341 start
10342 ==a==
10343 ===aa===
10344 ====aaa====
10345 ==b==
10346 ===ba===
10347 ===bb===
10348 ====bba====
10349 ===bc===
10350 ==c==
10351 ===ca===
10352 !! result
10353 ===bb===
10354 ====bba====
10355 !! end
10356
10357 !! test
10358 Section extraction test (section 7)
10359 !! options
10360 section=7
10361 !! input
10362 start
10363 ==a==
10364 ===aa===
10365 ====aaa====
10366 ==b==
10367 ===ba===
10368 ===bb===
10369 ====bba====
10370 ===bc===
10371 ==c==
10372 ===ca===
10373 !! result
10374 ====bba====
10375 !! end
10376
10377 !! test
10378 Section extraction test (section 8)
10379 !! options
10380 section=8
10381 !! input
10382 start
10383 ==a==
10384 ===aa===
10385 ====aaa====
10386 ==b==
10387 ===ba===
10388 ===bb===
10389 ====bba====
10390 ===bc===
10391 ==c==
10392 ===ca===
10393 !! result
10394 ===bc===
10395 !! end
10396
10397 !! test
10398 Section extraction test (section 9)
10399 !! options
10400 section=9
10401 !! input
10402 start
10403 ==a==
10404 ===aa===
10405 ====aaa====
10406 ==b==
10407 ===ba===
10408 ===bb===
10409 ====bba====
10410 ===bc===
10411 ==c==
10412 ===ca===
10413 !! result
10414 ==c==
10415 ===ca===
10416 !! end
10417
10418 !! test
10419 Section extraction test (section 10)
10420 !! options
10421 section=10
10422 !! input
10423 start
10424 ==a==
10425 ===aa===
10426 ====aaa====
10427 ==b==
10428 ===ba===
10429 ===bb===
10430 ====bba====
10431 ===bc===
10432 ==c==
10433 ===ca===
10434 !! result
10435 ===ca===
10436 !! end
10437
10438 !! test
10439 Section extraction test (nonexistent section 11)
10440 !! options
10441 section=11
10442 !! input
10443 start
10444 ==a==
10445 ===aa===
10446 ====aaa====
10447 ==b==
10448 ===ba===
10449 ===bb===
10450 ====bba====
10451 ===bc===
10452 ==c==
10453 ===ca===
10454 !! result
10455 !! end
10456
10457 !! test
10458 Section extraction test with bogus heading (section 1)
10459 !! options
10460 section=1
10461 !! input
10462 ==a==
10463 ==bogus== not a legal section
10464 ==b==
10465 !! result
10466 ==a==
10467 ==bogus== not a legal section
10468 !! end
10469
10470 !! test
10471 Section extraction test with bogus heading (section 2)
10472 !! options
10473 section=2
10474 !! input
10475 ==a==
10476 ==bogus== not a legal section
10477 ==b==
10478 !! result
10479 ==b==
10480 !! end
10481
10482 !! test
10483 Section extraction test with comment after heading (section 1)
10484 !! options
10485 section=1
10486 !! input
10487 ==a==
10488 ==b== <!-- -->
10489 ==c==
10490 !! result
10491 ==a==
10492 !! end
10493
10494 !! test
10495 Section extraction test with comment after heading (section 2)
10496 !! options
10497 section=2
10498 !! input
10499 ==a==
10500 ==b== <!-- -->
10501 ==c==
10502 !! result
10503 ==b== <!-- -->
10504 !! end
10505
10506 !! test
10507 Section extraction test with bogus <nowiki> heading (section 1)
10508 !! options
10509 section=1
10510 !! input
10511 ==a==
10512 ==bogus== <nowiki>not a legal section</nowiki>
10513 ==b==
10514 !! result
10515 ==a==
10516 ==bogus== <nowiki>not a legal section</nowiki>
10517 !! end
10518
10519 !! test
10520 Section extraction test with bogus <nowiki> heading (section 2)
10521 !! options
10522 section=2
10523 !! input
10524 ==a==
10525 ==bogus== <nowiki>not a legal section</nowiki>
10526 ==b==
10527 !! result
10528 ==b==
10529 !! end
10530
10531
10532 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10533 # instead of respecting commented sections
10534 !! test
10535 Section extraction prefixed by comment (section 1)
10536 !! options
10537 section=1
10538 !! input
10539 <!-- -->==sec1==
10540 ==sec2==
10541 !!result
10542 ==sec2==
10543 !!end
10544
10545 !! test
10546 Section extraction prefixed by comment (section 2)
10547 !! options
10548 section=2
10549 !! input
10550 <!-- -->==sec1==
10551 ==sec2==
10552 !!result
10553
10554 !!end
10555
10556
10557 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10558 # instead of respecting HTML-style headings
10559 !! test
10560 Section extraction, mixed wiki and html (section 1)
10561 !! options
10562 section=1
10563 !! input
10564 <h2>unmarked</h2>
10565 unmarked
10566 ==1==
10567 one
10568 ==2==
10569 two
10570 !! result
10571 ==1==
10572 one
10573 !! end
10574
10575 !! test
10576 Section extraction, mixed wiki and html (section 2)
10577 !! options
10578 section=2
10579 !! input
10580 <h2>unmarked</h2>
10581 unmarked
10582 ==1==
10583 one
10584 ==2==
10585 two
10586 !! result
10587 ==2==
10588 two
10589 !! end
10590
10591
10592 # Formerly testing for bug 3342
10593 !! test
10594 Section extraction, heading surrounded by <noinclude>
10595 !! options
10596 section=1
10597 !! input
10598 <noinclude>==unmarked==</noinclude>
10599 ==marked==
10600 !! result
10601 ==marked==
10602 !!end
10603
10604 # Test behavior of bug 19910
10605 !! test
10606 Sectiion with all-equals
10607 !! options
10608 section=2
10609 !! input
10610 ===
10611 The line above must have a trailing space
10612 === <!--
10613 --> <!-- -->
10614 But just in case it doesn't...
10615 !! result
10616 === <!--
10617 --> <!-- -->
10618 But just in case it doesn't...
10619 !! end
10620
10621 !! test
10622 Section replacement test (section 0)
10623 !! options
10624 replace=0,"xxx"
10625 !! input
10626 start
10627 ==a==
10628 ===aa===
10629 ====aaa====
10630 ==b==
10631 ===ba===
10632 ===bb===
10633 ====bba====
10634 ===bc===
10635 ==c==
10636 ===ca===
10637 !! result
10638 xxx
10639
10640 ==a==
10641 ===aa===
10642 ====aaa====
10643 ==b==
10644 ===ba===
10645 ===bb===
10646 ====bba====
10647 ===bc===
10648 ==c==
10649 ===ca===
10650 !! end
10651
10652 !! test
10653 Section replacement test (section 1)
10654 !! options
10655 replace=1,"xxx"
10656 !! input
10657 start
10658 ==a==
10659 ===aa===
10660 ====aaa====
10661 ==b==
10662 ===ba===
10663 ===bb===
10664 ====bba====
10665 ===bc===
10666 ==c==
10667 ===ca===
10668 !! result
10669 start
10670 xxx
10671
10672 ==b==
10673 ===ba===
10674 ===bb===
10675 ====bba====
10676 ===bc===
10677 ==c==
10678 ===ca===
10679 !! end
10680
10681 !! test
10682 Section replacement test (section 2)
10683 !! options
10684 replace=2,"xxx"
10685 !! input
10686 start
10687 ==a==
10688 ===aa===
10689 ====aaa====
10690 ==b==
10691 ===ba===
10692 ===bb===
10693 ====bba====
10694 ===bc===
10695 ==c==
10696 ===ca===
10697 !! result
10698 start
10699 ==a==
10700 xxx
10701
10702 ==b==
10703 ===ba===
10704 ===bb===
10705 ====bba====
10706 ===bc===
10707 ==c==
10708 ===ca===
10709 !! end
10710
10711 !! test
10712 Section replacement test (section 3)
10713 !! options
10714 replace=3,"xxx"
10715 !! input
10716 start
10717 ==a==
10718 ===aa===
10719 ====aaa====
10720 ==b==
10721 ===ba===
10722 ===bb===
10723 ====bba====
10724 ===bc===
10725 ==c==
10726 ===ca===
10727 !! result
10728 start
10729 ==a==
10730 ===aa===
10731 xxx
10732
10733 ==b==
10734 ===ba===
10735 ===bb===
10736 ====bba====
10737 ===bc===
10738 ==c==
10739 ===ca===
10740 !! end
10741
10742 !! test
10743 Section replacement test (section 4)
10744 !! options
10745 replace=4,"xxx"
10746 !! input
10747 start
10748 ==a==
10749 ===aa===
10750 ====aaa====
10751 ==b==
10752 ===ba===
10753 ===bb===
10754 ====bba====
10755 ===bc===
10756 ==c==
10757 ===ca===
10758 !! result
10759 start
10760 ==a==
10761 ===aa===
10762 ====aaa====
10763 xxx
10764
10765 ==c==
10766 ===ca===
10767 !! end
10768
10769 !! test
10770 Section replacement test (section 5)
10771 !! options
10772 replace=5,"xxx"
10773 !! input
10774 start
10775 ==a==
10776 ===aa===
10777 ====aaa====
10778 ==b==
10779 ===ba===
10780 ===bb===
10781 ====bba====
10782 ===bc===
10783 ==c==
10784 ===ca===
10785 !! result
10786 start
10787 ==a==
10788 ===aa===
10789 ====aaa====
10790 ==b==
10791 xxx
10792
10793 ===bb===
10794 ====bba====
10795 ===bc===
10796 ==c==
10797 ===ca===
10798 !! end
10799
10800 !! test
10801 Section replacement test (section 6)
10802 !! options
10803 replace=6,"xxx"
10804 !! input
10805 start
10806 ==a==
10807 ===aa===
10808 ====aaa====
10809 ==b==
10810 ===ba===
10811 ===bb===
10812 ====bba====
10813 ===bc===
10814 ==c==
10815 ===ca===
10816 !! result
10817 start
10818 ==a==
10819 ===aa===
10820 ====aaa====
10821 ==b==
10822 ===ba===
10823 xxx
10824
10825 ===bc===
10826 ==c==
10827 ===ca===
10828 !! end
10829
10830 !! test
10831 Section replacement test (section 7)
10832 !! options
10833 replace=7,"xxx"
10834 !! input
10835 start
10836 ==a==
10837 ===aa===
10838 ====aaa====
10839 ==b==
10840 ===ba===
10841 ===bb===
10842 ====bba====
10843 ===bc===
10844 ==c==
10845 ===ca===
10846 !! result
10847 start
10848 ==a==
10849 ===aa===
10850 ====aaa====
10851 ==b==
10852 ===ba===
10853 ===bb===
10854 xxx
10855
10856 ===bc===
10857 ==c==
10858 ===ca===
10859 !! end
10860
10861 !! test
10862 Section replacement test (section 8)
10863 !! options
10864 replace=8,"xxx"
10865 !! input
10866 start
10867 ==a==
10868 ===aa===
10869 ====aaa====
10870 ==b==
10871 ===ba===
10872 ===bb===
10873 ====bba====
10874 ===bc===
10875 ==c==
10876 ===ca===
10877 !! result
10878 start
10879 ==a==
10880 ===aa===
10881 ====aaa====
10882 ==b==
10883 ===ba===
10884 ===bb===
10885 ====bba====
10886 xxx
10887
10888 ==c==
10889 ===ca===
10890 !!end
10891
10892 !! test
10893 Section replacement test (section 9)
10894 !! options
10895 replace=9,"xxx"
10896 !! input
10897 start
10898 ==a==
10899 ===aa===
10900 ====aaa====
10901 ==b==
10902 ===ba===
10903 ===bb===
10904 ====bba====
10905 ===bc===
10906 ==c==
10907 ===ca===
10908 !! result
10909 start
10910 ==a==
10911 ===aa===
10912 ====aaa====
10913 ==b==
10914 ===ba===
10915 ===bb===
10916 ====bba====
10917 ===bc===
10918 xxx
10919 !! end
10920
10921 !! test
10922 Section replacement test (section 10)
10923 !! options
10924 replace=10,"xxx"
10925 !! input
10926 start
10927 ==a==
10928 ===aa===
10929 ====aaa====
10930 ==b==
10931 ===ba===
10932 ===bb===
10933 ====bba====
10934 ===bc===
10935 ==c==
10936 ===ca===
10937 !! result
10938 start
10939 ==a==
10940 ===aa===
10941 ====aaa====
10942 ==b==
10943 ===ba===
10944 ===bb===
10945 ====bba====
10946 ===bc===
10947 ==c==
10948 xxx
10949 !! end
10950
10951 !! test
10952 Section replacement test with initial whitespace (bug 13728)
10953 !! options
10954 replace=2,"xxx"
10955 !! input
10956 Preformatted initial line
10957 ==a==
10958 ===a===
10959 !! result
10960 Preformatted initial line
10961 ==a==
10962 xxx
10963 !! end
10964
10965
10966 !! test
10967 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10968 !! options
10969 section=1
10970 !! input
10971 ==a==
10972 a
10973 !! result
10974 ==a==
10975 a
10976 !! end
10977
10978 !! test
10979 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10980 !! options
10981 section=1
10982 !! input
10983 ==a==
10984 a
10985 !! result
10986 ==a==
10987 a
10988 !! end
10989
10990
10991 !! test
10992 Section extraction, <pre> around bogus header (bug 10309)
10993 !! options
10994 noxml section=2
10995 !! input
10996 == Section One ==
10997 <pre>
10998 =======
10999 </pre>
11000
11001 == Section Two ==
11002 stuff
11003 !! result
11004 == Section Two ==
11005 stuff
11006 !! end
11007
11008 !! test
11009 Section replacement, <pre> around bogus header (bug 10309)
11010 !! options
11011 noxml replace=2,"xxx"
11012 !! input
11013 == Section One ==
11014 <pre>
11015 =======
11016 </pre>
11017
11018 == Section Two ==
11019 stuff
11020 !! result
11021 == Section One ==
11022 <pre>
11023 =======
11024 </pre>
11025
11026 xxx
11027 !! end
11028
11029
11030
11031 !! test
11032 Handling of &#x0A; in URLs
11033 !! input
11034 **irc://&#x0A;a
11035 !! result
11036 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11037 </li></ul>
11038 </li></ul>
11039
11040 !!end
11041
11042 !! test
11043 5 quotes, code coverage +1 line (php)
11044 !! options
11045 php
11046 !! input
11047 '''''
11048 !! result
11049 !! end
11050 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11051 !! test
11052 5 quotes, code coverage +1 line (parsoid)
11053 !! options
11054 parsoid
11055 !! input
11056 '''''
11057 !! result
11058 <p><i><b></b></i></p>
11059 !! end
11060
11061 !! test
11062 Special:Search page linking.
11063 !! input
11064 {{Special:search}}
11065 !! result
11066 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11067 </p>
11068 !! end
11069
11070 !! test
11071 Say the magic word
11072 !! input
11073 * {{PAGENAME}}
11074 * {{BASEPAGENAME}}
11075 * {{SUBPAGENAME}}
11076 * {{SUBPAGENAMEE}}
11077 * {{ROOTPAGENAME}}
11078 * {{ROOTPAGENAMEE}}
11079 * {{BASEPAGENAME}}
11080 * {{BASEPAGENAMEE}}
11081 * {{TALKPAGENAME}}
11082 * {{TALKPAGENAMEE}}
11083 * {{SUBJECTPAGENAME}}
11084 * {{SUBJECTPAGENAMEE}}
11085 * {{NAMESPACEE}}
11086 * {{NAMESPACE}}
11087 * {{TALKSPACE}}
11088 * {{TALKSPACEE}}
11089 * {{SUBJECTSPACE}}
11090 * {{SUBJECTSPACEE}}
11091 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11092 !! result
11093 <ul><li> Parser test
11094 </li><li> Parser test
11095 </li><li> Parser test
11096 </li><li> Parser_test
11097 </li><li> Parser test
11098 </li><li> Parser_test
11099 </li><li> Parser test
11100 </li><li> Parser_test
11101 </li><li> Talk:Parser test
11102 </li><li> Talk:Parser_test
11103 </li><li> Parser test
11104 </li><li> Parser_test
11105 </li><li>
11106 </li><li>
11107 </li><li> Talk
11108 </li><li> Talk
11109 </li><li>
11110 </li><li>
11111 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11112 </li></ul>
11113
11114 !! end
11115 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11116
11117 !! test
11118 Gallery
11119 !! input
11120 <gallery>
11121 image1.png |
11122 image2.gif|||||
11123
11124 image3|
11125 image4 |300px| centre
11126 image5.svg| http://///////
11127 [[x|xx]]]]
11128 * image6
11129 </gallery>
11130 !! result
11131 <ul class="gallery">
11132 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11133 <div style="height: 150px;">Image1.png</div>
11134 <div class="gallerytext">
11135 </div>
11136 </div></li>
11137 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11138 <div style="height: 150px;">Image2.gif</div>
11139 <div class="gallerytext">
11140 <p>||||
11141 </p>
11142 </div>
11143 </div></li>
11144 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11145 <div style="height: 150px;">Image3</div>
11146 <div class="gallerytext">
11147 </div>
11148 </div></li>
11149 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11150 <div style="height: 150px;">Image4</div>
11151 <div class="gallerytext">
11152 <p>300px| centre
11153 </p>
11154 </div>
11155 </div></li>
11156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11157 <div style="height: 150px;">Image5.svg</div>
11158 <div class="gallerytext">
11159 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11160 </p>
11161 </div>
11162 </div></li>
11163 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11164 <div style="height: 150px;">* image6</div>
11165 <div class="gallerytext">
11166 </div>
11167 </div></li>
11168 </ul>
11169
11170 !! end
11171
11172 !! test
11173 Gallery (with options)
11174 !! input
11175 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11176 File:Nonexistant.jpg|caption
11177 File:Nonexistant.jpg
11178 image:foobar.jpg|some '''caption''' [[Main Page]]
11179 image:foobar.jpg
11180 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11181 </gallery>
11182 !! result
11183 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11184 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11185 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11186 <div style="height: 70px;">Nonexistant.jpg</div>
11187 <div class="gallerytext">
11188 <p>caption
11189 </p>
11190 </div>
11191 </div></li>
11192 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11193 <div style="height: 70px;">Nonexistant.jpg</div>
11194 <div class="gallerytext">
11195 </div>
11196 </div></li>
11197 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11198 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11199 <div class="gallerytext">
11200 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11201 </p>
11202 </div>
11203 </div></li>
11204 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11205 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11206 <div class="gallerytext">
11207 </div>
11208 </div></li>
11209 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11210 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11211 <div class="gallerytext">
11212 <p>Blabla|blabla.
11213 </p>
11214 </div>
11215 </div></li>
11216 </ul>
11217
11218 !! end
11219
11220 !! test
11221 Gallery with wikitext inside caption
11222 !! input
11223 <gallery>
11224 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11225 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11226 </gallery>
11227 !! result
11228 <ul class="gallery">
11229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11230 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11231 <div class="gallerytext">
11232 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11233 </p>
11234 </div>
11235 </div></li>
11236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11237 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11238 <div class="gallerytext">
11239 <p>This is a test template
11240 </p>
11241 </div>
11242 </div></li>
11243 </ul>
11244
11245 !! end
11246
11247 !! test
11248 gallery (with showfilename option)
11249 !! input
11250 <gallery showfilename>
11251 File:Nonexistant.jpg|caption
11252 File:Nonexistant.jpg
11253 image:foobar.jpg|some '''caption''' [[Main Page]]
11254 File:Foobar.jpg
11255 </gallery>
11256 !! result
11257 <ul class="gallery">
11258 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11259 <div style="height: 150px;">Nonexistant.jpg</div>
11260 <div class="gallerytext">
11261 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11262 caption
11263 </p>
11264 </div>
11265 </div></li>
11266 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11267 <div style="height: 150px;">Nonexistant.jpg</div>
11268 <div class="gallerytext">
11269 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11270 </p>
11271 </div>
11272 </div></li>
11273 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11274 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11275 <div class="gallerytext">
11276 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11277 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11278 </p>
11279 </div>
11280 </div></li>
11281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11282 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11283 <div class="gallerytext">
11284 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11285 </p>
11286 </div>
11287 </div></li>
11288 </ul>
11289
11290 !! end
11291
11292 !! test
11293 Gallery (with namespace-less filenames)
11294 !! input
11295 <gallery>
11296 File:Nonexistant.jpg
11297 Nonexistant.jpg
11298 image:foobar.jpg
11299 foobar.jpg
11300 </gallery>
11301 !! result
11302 <ul class="gallery">
11303 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11304 <div style="height: 150px;">Nonexistant.jpg</div>
11305 <div class="gallerytext">
11306 </div>
11307 </div></li>
11308 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11309 <div style="height: 150px;">Nonexistant.jpg</div>
11310 <div class="gallerytext">
11311 </div>
11312 </div></li>
11313 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11314 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11315 <div class="gallerytext">
11316 </div>
11317 </div></li>
11318 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11319 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11320 <div class="gallerytext">
11321 </div>
11322 </div></li>
11323 </ul>
11324
11325 !! end
11326
11327 !! test
11328 HTML Hex character encoding (spells the word "JavaScript")
11329 !! input
11330 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11331 !! result
11332 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11333 </p>
11334 !! end
11335
11336 !! test
11337 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11338 !! input
11339 &#xsee;&#XSEE;
11340 !! result
11341 <p>&amp;#xsee;&amp;#XSEE;
11342 </p>
11343 !! end
11344
11345 !! test
11346 HTML Hex character encoding mixed case
11347 !! input
11348 &#xEE;&#Xee;
11349 !! result
11350 <p>&#xee;&#xee;
11351 </p>
11352 !! end
11353
11354 !! test
11355 __FORCETOC__ override
11356 !! input
11357 __NEWSECTIONLINK__
11358 __FORCETOC__
11359 !! result
11360 <p><br />
11361 </p>
11362 !! end
11363
11364 !! test
11365 ISBN code coverage
11366 !! input
11367 ISBN 978-0-1234-56&#x20;789
11368 !! result
11369 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11370 </p>
11371 !! end
11372
11373 !! test
11374 ISBN followed by 5 spaces
11375 !! input
11376 ISBN
11377 !! result
11378 <p>ISBN
11379 </p>
11380 !! end
11381
11382 !! test
11383 Double ISBN
11384 !! input
11385 ISBN ISBN 1234567890
11386 !! result
11387 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11388 </p>
11389 !! end
11390
11391 !! test
11392 Bug 22905: <abbr> followed by ISBN followed by </a>
11393 !! input
11394 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11395 !! result
11396 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11397 </p>
11398 !! end
11399
11400 !! test
11401 Double RFC
11402 !! input
11403 RFC RFC 1234
11404 !! result
11405 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11406 </p>
11407 !! end
11408
11409 !! test
11410 Double RFC with a wiki link
11411 !! input
11412 RFC [[RFC 1234]]
11413 !! result
11414 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11415 </p>
11416 !! end
11417
11418 !! test
11419 RFC code coverage
11420 !! input
11421 RFC 983&#x20;987
11422 !! result
11423 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11424 </p>
11425 !! end
11426
11427 !! test
11428 Centre-aligned image
11429 !! input
11430 [[Image:foobar.jpg|centre]]
11431 !! result
11432 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11433
11434 !!end
11435
11436 !! test
11437 None-aligned image
11438 !! input
11439 [[Image:foobar.jpg|none]]
11440 !! result
11441 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11442
11443 !!end
11444
11445 !! test
11446 Width + Height sized image (using px) (height is ignored)
11447 !! input
11448 [[Image:foobar.jpg|640x480px]]
11449 !! result
11450 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11451 </p>
11452 !!end
11453
11454 !! test
11455 Width-sized image (using px, no following whitespace)
11456 !! input
11457 [[Image:foobar.jpg|640px]]
11458 !! result
11459 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11460 </p>
11461 !!end
11462
11463 !! test
11464 Width-sized image (using px, with following whitespace - test regression from r39467)
11465 !! input
11466 [[Image:foobar.jpg|640px ]]
11467 !! result
11468 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11469 </p>
11470 !!end
11471
11472 !! test
11473 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11474 !! input
11475 [[Image:foobar.jpg| 640px]]
11476 !! result
11477 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11478 </p>
11479 !!end
11480
11481 !! test
11482 Another italics / bold test
11483 !! input
11484 ''' ''x'
11485 !! result
11486 <pre>'<i> </i>x'
11487 </pre>
11488 !!end
11489
11490 # Note the results may be incorrect, as parserTest output included this:
11491 # XML error: Mismatched tag at byte 6120:
11492 # ...<dd> </dt></dl> </dd...
11493 !! test
11494 dt/dd/dl test
11495 !! options
11496 disabled
11497 !! input
11498 :;;;::
11499 !! result
11500 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11501 </dd></dl>
11502 </dd></dl>
11503 </dt></dl>
11504 </dt></dl>
11505 </dt></dl>
11506 </dd></dl>
11507
11508 !!end
11509
11510
11511 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11512 !! test
11513 Images with the "|" character in the comment
11514 !! input
11515 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11516 !! result
11517 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11518
11519 !!end
11520
11521 !! test
11522 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11523 !! input
11524 <html><script>alert(1);</script></html>
11525 !! result
11526 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11527 </p>
11528 !! end
11529
11530 !! test
11531 HTML with raw HTML ($wgRawHtml==true)
11532 !! options
11533 rawhtml
11534 !! input
11535 <html><script>alert(1);</script></html>
11536 !! result
11537 <p><script>alert(1);</script>
11538 </p>
11539 !! end
11540
11541 !! test
11542 Parents of subpages, one level up
11543 !! options
11544 subpage title=[[Subpage test/L1/L2/L3]]
11545 !! input
11546 [[../|L2]]
11547 !! result
11548 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11549 </p>
11550 !! end
11551
11552
11553 !! test
11554 Parents of subpages, one level up, not named
11555 !! options
11556 subpage title=[[Subpage test/L1/L2/L3]]
11557 !! input
11558 [[../]]
11559 !! result
11560 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11561 </p>
11562 !! end
11563
11564
11565
11566 !! test
11567 Parents of subpages, two levels up
11568 !! options
11569 subpage title=[[Subpage test/L1/L2/L3]]
11570 !! input
11571 [[../../|L1]]2
11572
11573 [[../../|L1]]l
11574 !! result
11575 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11576 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11577 </p>
11578 !! end
11579
11580 !! test
11581 Parents of subpages, two levels up, without trailing slash or name.
11582 !! options
11583 subpage title=[[Subpage test/L1/L2/L3]]
11584 !! input
11585 [[../..]]
11586 !! result
11587 <p>[[../..]]
11588 </p>
11589 !! end
11590
11591 !! test
11592 Parents of subpages, two levels up, with lots of extra trailing slashes.
11593 !! options
11594 subpage title=[[Subpage test/L1/L2/L3]]
11595 !! input
11596 [[../../////]]
11597 !! result
11598 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11599 </p>
11600 !! end
11601
11602 !! test
11603 Definition list code coverage
11604 !! input
11605 ; title : def
11606 ; title : def
11607 ;title: def
11608 !! result
11609 <dl><dt> title &#160;</dt><dd> def
11610 </dd><dt> title&#160;</dt><dd> def
11611 </dd><dt>title</dt><dd> def
11612 </dd></dl>
11613
11614 !! end
11615
11616 !! test
11617 Don't fall for the self-closing div
11618 !! input
11619 <div>hello world</div/>
11620 !! result
11621 <div>hello world</div>
11622
11623 !! end
11624
11625 !! test
11626 MSGNW magic word
11627 !! input
11628 {{MSGNW:msg}}
11629 !! result
11630 <p>&#91;&#91;:Template:Msg&#93;&#93;
11631 </p>
11632 !! end
11633
11634 !! test
11635 RAW magic word
11636 !! input
11637 {{RAW:QUERTY}}
11638 !! result
11639 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11640 </p>
11641 !! end
11642
11643 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11644 !! test
11645 Always escape literal '>' in output, not just after '<'
11646 !! input
11647 ><>
11648 !! result
11649 <p>&gt;&lt;&gt;
11650 </p>
11651 !! end
11652
11653 !! test
11654 Template caching
11655 !! input
11656 {{Test}}
11657 {{Test}}
11658 !! result
11659 <p>This is a test template
11660 This is a test template
11661 </p>
11662 !! end
11663
11664
11665 !! article
11666 MediaWiki:Fake
11667 !! text
11668 ==header==
11669 !! endarticle
11670
11671 !! test
11672 Inclusion of !userCanEdit() content
11673 !! input
11674 {{MediaWiki:Fake}}
11675 !! result
11676 <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11677
11678 !! end
11679
11680
11681 !! test
11682 Out-of-order TOC heading levels
11683 !! input
11684 ==2==
11685 ======6======
11686 ===3===
11687 =1=
11688 =====5=====
11689 ==2==
11690 !! result
11691 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11692 <ul>
11693 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11694 <ul>
11695 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11696 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11697 </ul>
11698 </li>
11699 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11700 <ul>
11701 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11702 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11703 </ul>
11704 </li>
11705 </ul>
11706 </td></tr></table>
11707 <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11708 <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11709 <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11710 <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11711 <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11712 <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11713
11714 !! end
11715
11716
11717 !! test
11718 ISBN with a dummy number
11719 !! input
11720 ISBN ---
11721 !! result
11722 <p>ISBN ---
11723 </p>
11724 !! end
11725
11726
11727 !! test
11728 ISBN with space-delimited number
11729 !! input
11730 ISBN 92 9017 032 8
11731 !! result
11732 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11733 </p>
11734 !! end
11735
11736
11737 !! test
11738 ISBN with multiple spaces, no number
11739 !! input
11740 ISBN foo
11741 !! result
11742 <p>ISBN foo
11743 </p>
11744 !! end
11745
11746
11747 !! test
11748 ISBN length
11749 !! input
11750 ISBN 123456789
11751
11752 ISBN 1234567890
11753
11754 ISBN 12345678901
11755 !! result
11756 <p>ISBN 123456789
11757 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11758 </p><p>ISBN 12345678901
11759 </p>
11760 !! end
11761
11762
11763 !! test
11764 ISBN with trailing year (bug 8110)
11765 !! input
11766 ISBN 1-234-56789-0 - 2006
11767
11768 ISBN 1 234 56789 0 - 2006
11769 !! result
11770 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11771 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11772 </p>
11773 !! end
11774
11775
11776 !! test
11777 anchorencode
11778 !! input
11779 {{anchorencode:foo bar©#%n}}
11780 !! result
11781 <p>foo_bar.C2.A9.23.25n
11782 </p>
11783 !! end
11784
11785 !! test
11786 anchorencode trims spaces
11787 !! input
11788 {{anchorencode: __pretty__please__}}
11789 !! result
11790 <p>pretty_please
11791 </p>
11792 !! end
11793
11794 !! test
11795 anchorencode deals with links
11796 !! input
11797 {{anchorencode: [[hello|world]] [[hi]]}}
11798 !! result
11799 <p>world_hi
11800 </p>
11801 !! end
11802
11803 !! test
11804 anchorencode deals with templates
11805 !! input
11806 {{anchorencode: {{Foo}} }}
11807 !! result
11808 <p>FOO
11809 </p>
11810 !! end
11811
11812 !! test
11813 anchorencode encodes like the TOC generator: (bug 18431)
11814 !! input
11815 === _ +:.3A%3A&&amp;]] ===
11816 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11817 __NOEDITSECTION__
11818 !! result
11819 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
11820 <p>.2B:.3A.253A.26.26.5D.5D
11821 </p>
11822 !! end
11823
11824 # Expected output in the following test is not necessarily expected (there
11825 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11826 # only testing for well-formedness.
11827 !! test
11828 Bug 6200: blockquotes and paragraph formatting
11829 !! input
11830 <blockquote>
11831 foo
11832 </blockquote>
11833
11834 bar
11835
11836 baz
11837 !! result
11838 <blockquote>
11839 foo
11840 </blockquote>
11841 <p>bar
11842 </p>
11843 <pre>baz
11844 </pre>
11845 !! end
11846
11847 !! test
11848 Bug 8293: Use of center tag ruins paragraph formatting
11849 !! input
11850 <center>
11851 foo
11852 </center>
11853
11854 bar
11855
11856 baz
11857 !! result
11858 <center>
11859 <p>foo
11860 </p>
11861 </center>
11862 <p>bar
11863 </p>
11864 <pre>baz
11865 </pre>
11866 !! end
11867
11868 !!test
11869 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11870 !!options
11871 php
11872 !!input
11873 <span><s>x</span></s>
11874 !!result
11875 <p><span><s>x&lt;/span&gt;</s></span>
11876 </p>
11877 !!end
11878
11879 !!test
11880 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11881 !!options
11882 parsoid
11883 !!input
11884 <span><s>x</span></s>
11885 !!result
11886 <p><span><s>x</s></span><s></s>
11887 </p>
11888 !!end
11889
11890 ###
11891 ### Language variants related tests
11892 ###
11893 !! test
11894 Self-link in language variants
11895 !! options
11896 title=[[Dunav]] language=sr
11897 !! input
11898 Both [[Dunav]] and [[Дунав]] are names for this river.
11899 !! result
11900 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11901 </p>
11902 !!end
11903
11904 !! article
11905 Дуна
11906 !! text
11907 content
11908 !! endarticle
11909
11910 !! test
11911 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11912 !! options
11913 title=[[Duna]] language=sr
11914 !! input
11915 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11916 !! result
11917 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11918 </p>
11919 !! end
11920
11921 !! test
11922 Link to pages in language variants
11923 !! options
11924 language=sr
11925 !! input
11926 Main Page can be written as [[Маин Паге]]
11927 !! result
11928 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11929 </p>
11930 !!end
11931
11932
11933 !! test
11934 Multiple links to pages in language variants
11935 !! options
11936 language=sr
11937 !! input
11938 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11939 !! result
11940 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11941 </p>
11942 !!end
11943
11944
11945 !! test
11946 Simple template in language variants
11947 !! options
11948 language=sr
11949 !! input
11950 {{тест}}
11951 !! result
11952 <p>This is a test template
11953 </p>
11954 !! end
11955
11956
11957 !! test
11958 Template with explicit namespace in language variants
11959 !! options
11960 language=sr
11961 !! input
11962 {{Template:тест}}
11963 !! result
11964 <p>This is a test template
11965 </p>
11966 !! end
11967
11968
11969 !! test
11970 Basic test for template parameter in language variants
11971 !! options
11972 language=sr
11973 !! input
11974 {{парамтест|param=foo}}
11975 !! result
11976 <p>This is a test template with parameter foo
11977 </p>
11978 !! end
11979
11980
11981 !! test
11982 Simple category in language variants
11983 !! options
11984 language=sr cat
11985 !! input
11986 [[Category:МедиаWики Усер'с Гуиде]]
11987 !! result
11988 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
11989 !! end
11990
11991
11992 !! article
11993 Category:分类
11994 !! text
11995 blah
11996 !! endarticle
11997
11998 !! article
11999 Category:分類
12000 !! text
12001 blah
12002 !! endarticle
12003
12004 !! test
12005 Don't convert blue categorylinks to another variant (bug 33210)
12006 !! options
12007 language=zh cat
12008 !! input
12009 [[A]][[Category:分类]]
12010 !! result
12011 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
12012 !! end
12013
12014
12015 !! test
12016 Stripping -{}- tags (language variants)
12017 !! options
12018 language=sr
12019 !! input
12020 Latin proverb: -{Ne nuntium necare}-
12021 !! result
12022 <p>Latin proverb: Ne nuntium necare
12023 </p>
12024 !! end
12025
12026
12027 !! test
12028 Prevent conversion with -{}- tags (language variants)
12029 !! options
12030 language=sr variant=sr-ec
12031 !! input
12032 Latinski: -{Ne nuntium necare}-
12033 !! result
12034 <p>Латински: Ne nuntium necare
12035 </p>
12036 !! end
12037
12038
12039 !! test
12040 Prevent conversion of text with -{}- tags (language variants)
12041 !! options
12042 language=sr variant=sr-ec
12043 !! input
12044 Latinski: -{Ne nuntium necare}-
12045 !! result
12046 <p>Латински: Ne nuntium necare
12047 </p>
12048 !! end
12049
12050
12051 !! test
12052 Prevent conversion of links with -{}- tags (language variants)
12053 !! options
12054 language=sr variant=sr-ec
12055 !! input
12056 -{[[Main Page]]}-
12057 !! result
12058 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12059 </p>
12060 !! end
12061
12062
12063 !! test
12064 -{}- tags within headlines (within html for parserConvert())
12065 !! options
12066 language=sr variant=sr-ec
12067 !! input
12068 == -{Naslov}- ==
12069 !! result
12070 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12071
12072 !! end
12073
12074
12075 !! test
12076 Explicit definition of language variant alternatives
12077 !! options
12078 language=zh variant=zh-tw
12079 !! input
12080 -{zh:China;zh-tw:Taiwan}-, not China
12081 !! result
12082 <p>Taiwan, not China
12083 </p>
12084 !! end
12085
12086
12087 !! test
12088 Conversion around HTML tags
12089 !! options
12090 language=sr variant=sr-ec
12091 !! input
12092 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12093 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12094 !! result
12095 <p>
12096 <span title="ЛаCтин">ски</span>
12097 </p>
12098 !! end
12099
12100
12101 !! test
12102 Explicit session-wise language variant mapping (A flag and - flag)
12103 !! options
12104 language=zh variant=zh-tw
12105 !! input
12106 Taiwan is not China.
12107 But -{A|zh:China;zh-tw:Taiwan}- is China,
12108 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12109 and -{China}- is China.
12110 !! result
12111 <p>Taiwan is not China.
12112 But Taiwan is Taiwan,
12113 (This should be stripped!)
12114 and China is China.
12115 </p>
12116 !! end
12117
12118 !! test
12119 Explicit session-wise language variant mapping (H flag for hide)
12120 !! options
12121 language=zh variant=zh-tw
12122 !! input
12123 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12124 Taiwan is China.
12125 !! result
12126 <p>(This should be stripped!)
12127 Taiwan is Taiwan.
12128 </p>
12129 !! end
12130
12131 !! test
12132 Adding explicit conversion rule for title (T flag)
12133 !! options
12134 language=zh variant=zh-tw showtitle
12135 !! input
12136 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12137 !! result
12138 Taiwan
12139 <p>Should be stripped!
12140 </p>
12141 !! end
12142
12143 !! test
12144 Testing that changing the language variant here in the tests actually works
12145 !! options
12146 language=zh variant=zh showtitle
12147 !! input
12148 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12149 !! result
12150 China
12151 <p>Should be stripped!
12152 </p>
12153 !! end
12154
12155 !! test
12156 Recursive conversion of alt and title attrs shouldn't clear converter state
12157 !! options
12158 language=zh variant=zh-cn showtitle
12159 !! input
12160 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12161 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12162 !! result
12163 China
12164 <p>
12165 Should be stripped<span title="Exclamation">!</span>
12166 </p>
12167 !! end
12168
12169 !! test
12170 Bug 24072: more test on conversion rule for title
12171 !! options
12172 language=zh variant=zh-tw showtitle
12173 !! input
12174 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12175 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12176 !! result
12177 Taiwan
12178 <p>This should be stripped!
12179 This won't take interferes with the title rule.
12180 </p>
12181 !! end
12182
12183 !! test
12184 Partly disable title conversion if variant == main language code
12185 !! options
12186 language=zh variant=zh title=[[ZH]] showtitle
12187 !! input
12188 -{T|zh-cn:CN;zh-tw:TW}-
12189 !! result
12190 ZH
12191 <p>
12192 </p>
12193 !! end
12194
12195 !! test
12196 Partly disable title conversion if variant == main language code, more
12197 !! options
12198 language=zh variant=zh title=[[ZH]] showtitle
12199 !! input
12200 -{T|TW}-
12201 !! result
12202 ZH
12203 <p>
12204 </p>
12205 !! end
12206
12207 !! test
12208 Raw output of variant escape tags (R flag)
12209 !! options
12210 language=zh variant=zh-tw
12211 !! input
12212 Raw: -{R|zh:China;zh-tw:Taiwan}-
12213 !! result
12214 <p>Raw: zh:China;zh-tw:Taiwan
12215 </p>
12216 !! end
12217
12218 !! test
12219 Nested using of manual convert syntax
12220 !! options
12221 language=zh variant=zh-hk
12222 !! input
12223 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12224 !! result
12225 <p>Nested: Hello Hong Kong!
12226 </p>
12227 !! end
12228
12229 !! test
12230 Proper conversion of text in external links
12231 !! options
12232 language=sr variant=sr-ec
12233 !! input
12234 http://www.google.com
12235 gopher://www.google.com
12236 [http://www.google.com http://www.google.com]
12237 [gopher://www.google.com gopher://www.google.com]
12238 [https://www.google.com irc://www.google.com]
12239 [ftp://www.google.com www.google.com/ftp://dir]
12240 [//www.google.com www.google.com]
12241 !! result
12242 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12243 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12244 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12245 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12246 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12247 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12248 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12249 </p>
12250 !! end
12251
12252 !! test
12253 Do not convert roman numbers to language variants
12254 !! options
12255 language=sr variant=sr-ec
12256 !! input
12257 Fridrih IV je car.
12258 !! result
12259 <p>Фридрих IV је цар.
12260 </p>
12261 !! end
12262
12263 !! test
12264 Unclosed language converter markup "-{"
12265 !! options
12266 language=sr
12267 !! input
12268 -{T|hello
12269 !! result
12270 <p>-{T|hello
12271 </p>
12272 !! end
12273
12274 !! test
12275 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12276 !! options
12277 language=sr
12278 !! input
12279 -{R|=&gt;}-
12280 !! result
12281 <p>=&gt;
12282 </p>
12283 !!end
12284
12285 !!article
12286 Template:Bullet
12287 !!text
12288 * Bar
12289 !!endarticle
12290
12291 !! test
12292 Bug 529: Uncovered bullet
12293 !! input
12294 * Foo {{bullet}}
12295 !! result
12296 <ul><li> Foo
12297 </li><li> Bar
12298 </li></ul>
12299
12300 !! end
12301
12302 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12303 # Templates in Wikipedia rely on this behavior, as tidy has always been
12304 # enabled there. These tests are normally run *without* tidy, so specify the
12305 # full output here.
12306 # To test realistic parsing behavior, apply a tidy-like transformation to both
12307 # the expected output and your parser's output.
12308 !! test
12309 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12310 !! input
12311 ******* Foo {{bullet}}
12312 !! result
12313 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12314 </li></ul>
12315 </li></ul>
12316 </li></ul>
12317 </li></ul>
12318 </li></ul>
12319 </li></ul>
12320 </li><li> Bar
12321 </li></ul>
12322
12323 !! end
12324
12325 !! test
12326 Bug 529: Uncovered table already at line-start
12327 !! input
12328 x
12329
12330 {{table}}
12331 y
12332 !! result
12333 <p>x
12334 </p>
12335 <table>
12336 <tr>
12337 <td> 1 </td>
12338 <td> 2
12339 </td></tr>
12340 <tr>
12341 <td> 3 </td>
12342 <td> 4
12343 </td></tr></table>
12344 <p>y
12345 </p>
12346 !! end
12347
12348 !! test
12349 Bug 529: Uncovered bullet in parser function result
12350 !! input
12351 * Foo {{lc:{{bullet}} }}
12352 !! result
12353 <ul><li> Foo
12354 </li><li> bar
12355 </li></ul>
12356
12357 !! end
12358
12359 !! test
12360 Bug 5678: Double-parsed template argument
12361 !! input
12362 {{lc:{{{1}}}|hello}}
12363 !! result
12364 <p>{{{1}}}
12365 </p>
12366 !! end
12367
12368 !! test
12369 Bug 5678: Double-parsed template invocation
12370 !! input
12371 {{lc:{{paramtest {{!}} param = hello }} }}
12372 !! result
12373 <p>{{paramtest | param = hello }}
12374 </p>
12375 !! end
12376
12377 !! test
12378 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12379 !! options
12380 language=cs
12381 title=[[Main Page]]
12382 !! input
12383 {{PRVNÍVELKÉ:ěščř}}
12384 {{prvnívelké:ěščř}}
12385 {{PRVNÍMALÉ:ěščř}}
12386 {{prvnímalé:ěščř}}
12387 {{MALÁ:ěščř}}
12388 {{malá:ěščř}}
12389 {{VELKÁ:ěščř}}
12390 {{velká:ěščř}}
12391 !! result
12392 <p>Ěščř
12393 Ěščř
12394 ěščř
12395 ěščř
12396 ěščř
12397 ěščř
12398 ĚŠČŘ
12399 ĚŠČŘ
12400 </p>
12401 !! end
12402
12403 !! test
12404 Morwen/13: Unclosed link followed by heading
12405 !! input
12406 [[link
12407 ==heading==
12408 !! result
12409 <p>[[link
12410 </p>
12411 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12412
12413 !! end
12414
12415 !! test
12416 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12417 !! input
12418 {{foo|
12419 =heading=
12420 !! result
12421 <p>{{foo|
12422 </p>
12423 <h1><span class="mw-headline" id="heading">heading</span></h1>
12424
12425 !! end
12426
12427 !! test
12428 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12429 !! input
12430 {{foo|
12431 ==heading==
12432 !! result
12433 <p>{{foo|
12434 </p>
12435 <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12436
12437 !! end
12438
12439 !! test
12440 Tildes in comments
12441 !! options
12442 pst
12443 !! input
12444 <!-- ~~~~ -->
12445 !! result
12446 <!-- ~~~~ -->
12447 !! end
12448
12449 !! test
12450 Paragraphs inside divs (no extra line breaks)
12451 !! input
12452 <div>Line one
12453
12454 Line two</div>
12455 !! result
12456 <div>Line one
12457 Line two</div>
12458
12459 !! end
12460
12461 !! test
12462 Paragraphs inside divs (extra line break on open)
12463 !! input
12464 <div>
12465 Line one
12466
12467 Line two</div>
12468 !! result
12469 <div>
12470 <p>Line one
12471 </p>
12472 Line two</div>
12473
12474 !! end
12475
12476 !! test
12477 Paragraphs inside divs (extra line break on close)
12478 !! input
12479 <div>Line one
12480
12481 Line two
12482 </div>
12483 !! result
12484 <div>Line one
12485 <p>Line two
12486 </p>
12487 </div>
12488
12489 !! end
12490
12491 !! test
12492 Paragraphs inside divs (extra line break on open and close)
12493 !! input
12494 <div>
12495 Line one
12496
12497 Line two
12498 </div>
12499 !! result
12500 <div>
12501 <p>Line one
12502 </p><p>Line two
12503 </p>
12504 </div>
12505
12506 !! end
12507
12508 !! test
12509 Nesting tags, paragraphs on lines which begin with <div>
12510 !! options
12511 disabled
12512 !! input
12513 <div></div><strong>A
12514 B</strong>
12515 !! result
12516 <div></div>
12517 <p><strong>A
12518 B</strong>
12519 </p>
12520 !! end
12521
12522 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12523 !! test
12524 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12525 !! options
12526 disabled
12527 !! input
12528 <blockquote>Line one
12529
12530 Line two</blockquote>
12531 !! result
12532 <blockquote>Line one
12533 Line two</blockquote>
12534
12535 !! end
12536
12537 !! test
12538 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12539 !! options
12540 disabled
12541 !! input
12542 <blockquote>
12543 Line one
12544
12545 Line two</blockquote>
12546 !! result
12547 <blockquote>
12548 <p>Line one
12549 </p>
12550 Line two</blockquote>
12551
12552 !! end
12553
12554 !! test
12555 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12556 !! options
12557 disabled
12558 !! input
12559 <blockquote>Line one
12560
12561 Line two
12562 </blockquote>
12563 !! result
12564 <blockquote>Line one
12565 <p>Line two
12566 </p>
12567 </blockquote>
12568
12569 !! end
12570
12571 !! test
12572 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12573 !! options
12574 disabled
12575 !! input
12576 <blockquote>
12577 Line one
12578
12579 Line two
12580 </blockquote>
12581 !! result
12582 <blockquote>
12583 <p>Line one
12584 </p><p>Line two
12585 </p>
12586 </blockquote>
12587
12588 !! end
12589
12590 !! test
12591 Paragraphs inside blockquotes/divs (no extra line breaks)
12592 !! input
12593 <blockquote><div>Line one
12594
12595 Line two</div></blockquote>
12596 !! result
12597 <blockquote><div>Line one
12598 Line two</div></blockquote>
12599
12600 !! end
12601
12602 !! test
12603 Paragraphs inside blockquotes/divs (extra line break on open)
12604 !! input
12605 <blockquote><div>
12606 Line one
12607
12608 Line two</div></blockquote>
12609 !! result
12610 <blockquote><div>
12611 <p>Line one
12612 </p>
12613 Line two</div></blockquote>
12614
12615 !! end
12616
12617 !! test
12618 Paragraphs inside blockquotes/divs (extra line break on close)
12619 !! input
12620 <blockquote><div>Line one
12621
12622 Line two
12623 </div></blockquote>
12624 !! result
12625 <blockquote><div>Line one
12626 <p>Line two
12627 </p>
12628 </div></blockquote>
12629
12630 !! end
12631
12632 !! test
12633 Paragraphs inside blockquotes/divs (extra line break on open and close)
12634 !! input
12635 <blockquote><div>
12636 Line one
12637
12638 Line two
12639 </div></blockquote>
12640 !! result
12641 <blockquote><div>
12642 <p>Line one
12643 </p><p>Line two
12644 </p>
12645 </div></blockquote>
12646
12647 !! end
12648
12649 !! test
12650 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12651 !! options
12652 wgLinkHolderBatchSize=0
12653 !! input
12654 [[meatball:1]]
12655 [[meatball:2]]
12656 [[meatball:3]]
12657 !! result
12658 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12659 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12660 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12661 </p>
12662 !! end
12663
12664 !! test
12665 Free external link invading image caption
12666 !! input
12667 [[Image:Foobar.jpg|thumb|http://x|hello]]
12668 !! result
12669 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12670
12671 !! end
12672
12673 !! test
12674 Bug 15196: localised external link numbers
12675 !! options
12676 language=fa
12677 !! input
12678 [http://en.wikipedia.org/]
12679 !! result
12680 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12681 </p>
12682 !! end
12683
12684 !! test
12685 Multibyte character in padleft
12686 !! input
12687 {{padleft:-Hello|7|Æ}}
12688 !! result
12689 <p>Æ-Hello
12690 </p>
12691 !! end
12692
12693 !! test
12694 Multibyte character in padright
12695 !! input
12696 {{padright:Hello-|7|Æ}}
12697 !! result
12698 <p>Hello-Æ
12699 </p>
12700 !! end
12701
12702 !!test
12703 formatdate parser function
12704 !!input
12705 {{#formatdate:2009-03-24}}
12706 !! result
12707 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12708 </p>
12709 !! end
12710
12711 !!test
12712 formatdate parser function, with default format
12713 !!input
12714 {{#formatdate:2009-03-24|mdy}}
12715 !! result
12716 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12717 </p>
12718 !! end
12719
12720 !! test
12721 Spacing of numbers in formatted dates
12722 !! input
12723 {{#formatdate:January 15}}
12724 !! result
12725 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12726 </p>
12727 !! end
12728
12729 !! test
12730 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12731 !! options
12732 language=nl title=[[MediaWiki:Common.css]]
12733 !! input
12734 {{#formatdate:2009-03-24|dmy}}
12735 !! result
12736 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12737 </p>
12738 !! end
12739
12740 #
12741 #
12742 #
12743
12744 #
12745 # Edit comments
12746 #
12747
12748 !! test
12749 Edit comment with link
12750 !! options
12751 comment
12752 !! input
12753 I like the [[Main Page]] a lot
12754 !! result
12755 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12756 !!end
12757
12758 !! test
12759 Edit comment with link and link text
12760 !! options
12761 comment
12762 !! input
12763 I like the [[Main Page|best pages]] a lot
12764 !! result
12765 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12766 !!end
12767
12768 !! test
12769 Edit comment with link and link text with suffix
12770 !! options
12771 comment
12772 !! input
12773 I like the [[Main Page|best page]]s a lot
12774 !! result
12775 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12776 !!end
12777
12778 !! test
12779 Edit comment with section link (non-local, eg in history list)
12780 !! options
12781 comment title=[[Main Page]]
12782 !! input
12783 /* External links */ removed bogus entries
12784 !! result
12785 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12786 !!end
12787
12788 !! test
12789 Edit comment with section link and text before it (non-local, eg in history list)
12790 !! options
12791 comment title=[[Main Page]]
12792 !! input
12793 pre-comment text /* External links */ removed bogus entries
12794 !! result
12795 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12796 !!end
12797
12798 !! test
12799 Edit comment with section link (local, eg in diff view)
12800 !! options
12801 comment local title=[[Main Page]]
12802 !! input
12803 /* External links */ removed bogus entries
12804 !! result
12805 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12806 !!end
12807
12808 !! test
12809 Edit comment with subpage link (bug 14080)
12810 !! options
12811 comment
12812 subpage
12813 title=[[Subpage test]]
12814 !! input
12815 Poked at a [[/subpage]] here...
12816 !! result
12817 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12818 !!end
12819
12820 !! test
12821 Edit comment with subpage link and link text (bug 14080)
12822 !! options
12823 comment
12824 subpage
12825 title=[[Subpage test]]
12826 !! input
12827 Poked at a [[/subpage|neat little page]] here...
12828 !! result
12829 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12830 !!end
12831
12832 !! test
12833 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12834 !! options
12835 comment
12836 title=[[Subpage test]]
12837 !! input
12838 Poked at a [[/subpage]] here...
12839 !! result
12840 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12841 !!end
12842
12843 !! test
12844 Edit comment with bare anchor link (local, as on diff)
12845 !! options
12846 comment
12847 local
12848 title=[[Main Page]]
12849 !!input
12850 [[#section]]
12851 !! result
12852 <a href="#section">#section</a>
12853 !! end
12854
12855 !! test
12856 Edit comment with bare anchor link (non-local, as on history)
12857 !! options
12858 comment
12859 title=[[Main Page]]
12860 !!input
12861 [[#section]]
12862 !! result
12863 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12864 !! end
12865
12866 !! test
12867 Anchor starting with underscore
12868 !!input
12869 [[#_ref|One]]
12870 !! result
12871 <p><a href="#_ref">One</a>
12872 </p>
12873 !! end
12874
12875 !! test
12876 Id starting with underscore
12877 !!input
12878 <div id="_ref"></div>
12879 !! result
12880 <div id="_ref"></div>
12881
12882 !! end
12883
12884 !! test
12885 Space normalisation on autocomment (bug 22784)
12886 !! options
12887 comment
12888 title=[[Main Page]]
12889 !!input
12890 /* __hello__world__ */
12891 !! result
12892 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12893 !! end
12894
12895 !! test
12896 percent-encoding and + signs in comments (Bug 26410)
12897 !! options
12898 comment
12899 !!input
12900 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12901 !! result
12902 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12903 !! end
12904
12905 !! test
12906 Bad images - basic functionality
12907 !! options
12908 disabled
12909 !! input
12910 [[File:Bad.jpg]]
12911 !! result
12912 !! end
12913
12914 !! test
12915 Bad images - bug 16039: text after bad image disappears
12916 !! options
12917 disabled
12918 !! input
12919 Foo bar
12920 [[File:Bad.jpg]]
12921 Bar foo
12922 !! result
12923 <p>Foo bar
12924 </p><p>Bar foo
12925 </p>
12926 !! end
12927
12928 !! test
12929 Verify that displaytitle works (bug #22501) no displaytitle
12930 !! options
12931 showtitle
12932 !! config
12933 wgAllowDisplayTitle=true
12934 wgRestrictDisplayTitle=false
12935 !! input
12936 this is not the the title
12937 !! result
12938 Parser test
12939 <p>this is not the the title
12940 </p>
12941 !! end
12942
12943 !! test
12944 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12945 !! options
12946 showtitle
12947 title=[[Screen]]
12948 !! config
12949 wgAllowDisplayTitle=true
12950 wgRestrictDisplayTitle=false
12951 !! input
12952 this is not the the title
12953 {{DISPLAYTITLE:whatever}}
12954 !! result
12955 whatever
12956 <p>this is not the the title
12957 </p>
12958 !! end
12959
12960 !! test
12961 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12962 !! options
12963 showtitle
12964 title=[[Screen]]
12965 !! config
12966 wgAllowDisplayTitle=true
12967 wgRestrictDisplayTitle=true
12968 !! input
12969 this is not the the title
12970 {{DISPLAYTITLE:whatever}}
12971 !! result
12972 Screen
12973 <p>this is not the the title
12974 </p>
12975 !! end
12976
12977 !! test
12978 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12979 !! options
12980 showtitle
12981 title=[[Screen]]
12982 !! config
12983 wgAllowDisplayTitle=true
12984 wgRestrictDisplayTitle=true
12985 !! input
12986 this is not the the title
12987 {{DISPLAYTITLE:screen}}
12988 !! result
12989 screen
12990 <p>this is not the the title
12991 </p>
12992 !! end
12993
12994 !! test
12995 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12996 !! options
12997 showtitle
12998 title=[[Screen]]
12999 !! config
13000 wgAllowDisplayTitle=false
13001 !! input
13002 this is not the the title
13003 {{DISPLAYTITLE:screen}}
13004 !! result
13005 Screen
13006 <p>this is not the the title
13007 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
13008 </p>
13009 !! end
13010
13011 !! test
13012 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
13013 !! options
13014 showtitle
13015 title=[[Screen]]
13016 !! config
13017 wgAllowDisplayTitle=false
13018 !! input
13019 this is not the the title
13020 !! result
13021 Screen
13022 <p>this is not the the title
13023 </p>
13024 !! end
13025
13026 !! test
13027 preload: check <noinclude> and <includeonly>
13028 !! options
13029 preload
13030 !! input
13031 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
13032 !! result
13033 Hello kind world.
13034 !! end
13035
13036 !! test
13037 preload: check <onlyinclude>
13038 !! options
13039 preload
13040 !! input
13041 Goodbye <onlyinclude>Hello world</onlyinclude>
13042 !! result
13043 Hello world
13044 !! end
13045
13046 !! test
13047 preload: can pass tags through if we want to
13048 !! options
13049 preload
13050 !! input
13051 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13052 !! result
13053 <includeonly>Hello world</includeonly>
13054 !! end
13055
13056 !! test
13057 preload: check that it doesn't try to do tricks
13058 !! options
13059 preload
13060 !! input
13061 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13062 !! result
13063 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13064 !! end
13065
13066 !! test
13067 Play a bit with r67090 and bug 3158
13068 !! options
13069 disabled
13070 !! input
13071 <div style="width:50% !important">&nbsp;</div>
13072 <div style="width:50%&nbsp;!important">&nbsp;</div>
13073 <div style="width:50%&#160;!important">&nbsp;</div>
13074 <div style="border : solid;">&nbsp;</div>
13075 !! result
13076 <div style="width:50% !important">&nbsp;</div>
13077 <div style="width:50% !important">&nbsp;</div>
13078 <div style="width:50% !important">&nbsp;</div>
13079 <div style="border&#160;: solid;">&nbsp;</div>
13080
13081 !! end
13082
13083 !! test
13084 HTML5 data attributes
13085 !! input
13086 <span data-foo="bar">Baz</span>
13087 <p data-abc-def_hij="">Quuz</p>
13088 !! result
13089 <p><span data-foo="bar">Baz</span>
13090 </p>
13091 <p data-abc-def_hij="">Quuz</p>
13092
13093 !! end
13094
13095 !! test
13096 percent-encoding and + signs in internal links (Bug 26410)
13097 !! input
13098 [[User:+%]] [[Page+title%]]
13099 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13100 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13101 [[%33%45]] [[%33%45+]]
13102 !! result
13103 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
13104 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
13105 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
13106 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
13107 </p>
13108 !! end
13109
13110 !! test
13111 Special characters in embedded file links (bug 27679)
13112 !! input
13113 [[File:Contains & ampersand.jpg]]
13114 [[File:Does not exist.jpg|Title with & ampersand]]
13115 !! result
13116 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13117 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13118 </p>
13119 !! end
13120
13121
13122 !! test
13123 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13124 !! input
13125 Text&apos;s been normalized?
13126 !! result
13127 <p>Text&#39;s been normalized?
13128 </p>
13129 !! end
13130
13131 !! test
13132 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13133 !! input
13134 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13135 !! result
13136 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13137 </p>
13138 !! end
13139
13140 !! test
13141 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13142 !! input
13143 [http://www.example.org/ ideograms]
13144 !! result
13145 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13146 </p>
13147 !! end
13148
13149 !! test
13150 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13151 !! input
13152 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13153 !! result
13154 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13155 </p>
13156 !! end
13157
13158 !! article
13159 Mediawiki:loop1
13160 !! text
13161 {{Identical|A}}
13162 !! endarticle
13163
13164 !! article
13165 Mediawiki:loop2
13166 !! text
13167 {{Identical|B}}
13168 !! endarticle
13169
13170 !! article
13171 Template:Identical
13172 !! text
13173 {{int:loop1}}
13174 {{int:loop2}}
13175 !! endarticle
13176
13177 !! test
13178 Bug 31098 Template which includes system messages which includes the template
13179 !! input
13180 {{Identical}}
13181 !! result
13182 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13183 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13184 </p>
13185 !! end
13186
13187 !! test
13188 Bug31490 Turkish: ucfirst 'blah'
13189 !! options
13190 language=tr
13191 !! input
13192 {{ucfirst:blah}}
13193 !! result
13194 <p>Blah
13195 </p>
13196 !! end
13197
13198 !! test
13199 Bug31490 Turkish: ucfirst 'ix'
13200 !! options
13201 language=tr
13202 !! input
13203 {{ucfirst:ix}}
13204 !! result
13205 <p>İx
13206 </p>
13207 !! end
13208
13209 !! test
13210 Bug31490 Turkish: lcfirst 'BLAH'
13211 !! options
13212 language=tr
13213 !! input
13214 {{lcfirst:BLAH}}
13215 !! result
13216 <p>bLAH
13217 </p>
13218 !! end
13219
13220 !! test
13221 Bug31490 Turkish: ucfırst (with a dotless i)
13222 !! options
13223 language=tr
13224 !! input
13225 {{ucfırst:blah}}
13226 !! result
13227 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13228 </p>
13229 !! end
13230
13231 !! test
13232 Bug31490 ucfırst (with a dotless i) with English language
13233 !! options
13234 language=en
13235 !! input
13236 {{ucfırst:blah}}
13237 !! result
13238 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13239 </p>
13240 !! end
13241
13242 !! test
13243 Bug 26375: TOC with italics
13244 !! options
13245 title=[[Main Page]]
13246 !! input
13247 __TOC__
13248 == ''Lost'' episodes ==
13249 !! result
13250 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13251 <ul>
13252 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13253 </ul>
13254 </td></tr></table>
13255 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13256
13257 !! end
13258
13259 !! test
13260 Bug 26375: TOC with bold
13261 !! options
13262 title=[[Main Page]]
13263 !! input
13264 __TOC__
13265 == '''should be bold''' then normal text ==
13266 !! result
13267 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13268 <ul>
13269 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13270 </ul>
13271 </td></tr></table>
13272 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span></h2>
13273
13274 !! end
13275
13276 !! test
13277 Bug 33845: Headings become cursive in TOC when they contain an image
13278 !! options
13279 title=[[Main Page]]
13280 !! input
13281 __TOC__
13282 == Image [[Image:foobar.jpg]] ==
13283 !! result
13284 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13285 <ul>
13286 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13287 </ul>
13288 </td></tr></table>
13289 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13290
13291 !! end
13292
13293 !! test
13294 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13295 !! options
13296 title=[[Main Page]]
13297 !! input
13298 __TOC__
13299 == <blockquote>Quote</blockquote> ==
13300 !! result
13301 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13302 <ul>
13303 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13304 </ul>
13305 </td></tr></table>
13306 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13307
13308 !! end
13309
13310 !! test
13311 Unclosed tags in TOC
13312 !! options
13313 title=[[Main Page]]
13314 !! input
13315 __TOC__
13316 == Proof: 2 < 3 ==
13317 <small>Hanc marginis exiguitas non caperet.</small>
13318 QED
13319 !! result
13320 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13321 <ul>
13322 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13323 </ul>
13324 </td></tr></table>
13325 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13326 <p><small>Hanc marginis exiguitas non caperet.</small>
13327 QED
13328 </p>
13329 !! end
13330
13331 !! test
13332 Multiple tags in TOC
13333 !! input
13334 __TOC__
13335 == <i>Foo</i> <b>Bar</b> ==
13336
13337 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13338 !! result
13339 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13340 <ul>
13341 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13342 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13343 </ul>
13344 </td></tr></table>
13345 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13346 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13347
13348 !! end
13349
13350 !! test
13351 Tags with parameters in TOC
13352 !! input
13353 __TOC__
13354 == <sup class="in-h2">Hello</sup> ==
13355
13356 == <sup class="a > b">Evilbye</sup> ==
13357 !! result
13358 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13359 <ul>
13360 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13361 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13362 </ul>
13363 </td></tr></table>
13364 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13365 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13366
13367 !! end
13368
13369 !! test
13370 span tags with directionality in TOC
13371 !! input
13372 __TOC__
13373 == <span dir="ltr">C++</span> ==
13374
13375 == <span dir="rtl">זבנג!</span> ==
13376
13377 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13378
13379 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13380
13381 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13382 !! result
13383 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13384 <ul>
13385 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13386 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13387 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13388 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13389 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13390 </ul>
13391 </td></tr></table>
13392 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13393 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13394 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13395 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13396 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13397
13398 !! end
13399
13400 !! article
13401 MediaWiki:Bug32057
13402 !! text
13403 == {{int:headline_sample}} ==
13404 !! endarticle
13405
13406 !! test
13407 Bug 32057: Title needed when expanding <h> nodes.
13408 !! options
13409 title=[[Main Page]]
13410 !! input
13411 {{int:Bug32057}}
13412 !! result
13413 <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13414
13415 !! end
13416
13417 !! test
13418 Strip marker in urlencode
13419 !! input
13420 {{urlencode:x<nowiki/>y}}
13421 {{urlencode:x<nowiki/>y|wiki}}
13422 {{urlencode:x<nowiki/>y|path}}
13423 !! result
13424 <p>xy
13425 xy
13426 xy
13427 </p>
13428 !! end
13429
13430 !! test
13431 Strip marker in lc
13432 !! input
13433 {{lc:x<nowiki/>y}}
13434 !! result
13435 <p>xy
13436 </p>
13437 !! end
13438
13439 !! test
13440 Strip marker in uc
13441 !! input
13442 {{uc:x<nowiki/>y}}
13443 !! result
13444 <p>XY
13445 </p>
13446 !! end
13447
13448 !! test
13449 Strip marker in formatNum
13450 !! input
13451 {{formatnum:1<nowiki/>2}}
13452 {{formatnum:1<nowiki/>2|R}}
13453 !! result
13454 <p>12
13455 12
13456 </p>
13457 !! end
13458
13459 !! test
13460 Check noCommafy in formatNum
13461 !! options
13462 language=be-tarask
13463 !! input
13464 {{formatnum:123456.78}}
13465 {{formatnum:123456.78|NOSEP}}
13466 !! result
13467 <p>123 456,78
13468 123456.78
13469 </p>
13470 !! end
13471
13472 !! test
13473 Strip marker in grammar
13474 !! options
13475 language=fi
13476 !! input
13477 {{grammar:elative|foo<nowiki/>bar}}
13478 !! result
13479 <p>foobarista
13480 </p>
13481 !! end
13482
13483 !! test
13484 Strip marker in padleft
13485 !! input
13486 {{padleft:|2|x<nowiki/>y}}
13487 !! result
13488 <p>xy
13489 </p>
13490 !! end
13491
13492 !! test
13493 Strip marker in padright
13494 !! input
13495 {{padright:|2|x<nowiki/>y}}
13496 !! result
13497 <p>xy
13498 </p>
13499 !! end
13500
13501 !! test
13502 Strip marker in anchorencode
13503 !! input
13504 {{anchorencode:x<nowiki/>y}}
13505 !! result
13506 <p>xy
13507 </p>
13508 !! end
13509
13510 !! test
13511 nowiki inside link inside heading (bug 18295)
13512 !! input
13513 ==[[foo|x<nowiki>y</nowiki>z]]==
13514 !! result
13515 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span><span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13516
13517 !! end
13518
13519 !! test
13520 new support for bdi element (bug 31817)
13521 !! input
13522 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13523 !! result
13524 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13525
13526 !!end
13527
13528 !! test
13529 Ignore pipe between table row attributes
13530 !! input
13531 {|
13532 | quux
13533 |- id=foo | style='color: red'
13534 | bar
13535 |}
13536 !! result
13537 <table>
13538 <tr>
13539 <td> quux
13540 </td></tr>
13541 <tr id="foo" style="color: red">
13542 <td> bar
13543 </td></tr></table>
13544
13545 !! end
13546
13547 !!test
13548 Gallery override link with WikiLink (bug 34852)
13549 !! input
13550 <gallery>
13551 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13552 </gallery>
13553 !! result
13554 <ul class="gallery">
13555 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13556 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13557 <div class="gallerytext">
13558 <p>caption
13559 </p>
13560 </div>
13561 </div></li>
13562 </ul>
13563
13564 !! end
13565
13566 !!test
13567 Gallery override link with absolute external link (bug 34852)
13568 !! input
13569 <gallery>
13570 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13571 </gallery>
13572 !! result
13573 <ul class="gallery">
13574 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13575 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13576 <div class="gallerytext">
13577 <p>caption
13578 </p>
13579 </div>
13580 </div></li>
13581 </ul>
13582
13583 !! end
13584
13585 !!test
13586 Gallery override link with malicious javascript (bug 34852)
13587 !! input
13588 <gallery>
13589 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13590 </gallery>
13591 !! result
13592 <ul class="gallery">
13593 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13594 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13595 <div class="gallerytext">
13596 <p>caption
13597 </p>
13598 </div>
13599 </div></li>
13600 </ul>
13601
13602 !! end
13603
13604 !!test
13605 Gallery with invalid title as link (bug 43964)
13606 !! input
13607 <gallery>
13608 File:foobar.jpg|link=<
13609 </gallery>
13610 !! result
13611 <ul class="gallery">
13612 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13613 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13614 <div class="gallerytext">
13615 </div>
13616 </div></li>
13617 </ul>
13618
13619 !! end
13620
13621 !!test
13622 Language parser function
13623 !! input
13624 {{#language:ar}}
13625 !! result
13626 <p>العربية
13627 </p>
13628 !! end
13629
13630 !!test
13631 Padleft and padright as substr
13632 !! input
13633 {{padleft:|3|abcde}}
13634 {{padright:|3|abcde}}
13635 !! result
13636 <p>abc
13637 abc
13638 </p>
13639 !! end
13640
13641 !!test
13642 Bug 34939 - Case insensitive link parsing ([HttP://])
13643 !! input
13644 [HttP://MediaWiki.Org/]
13645 !! result
13646 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13647 </p>
13648 !! end
13649
13650 !!test
13651 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13652 !! input
13653 [HttP://MediaWiki.Org/ MediaWiki]
13654 !! result
13655 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13656 </p>
13657 !! end
13658
13659 !!test
13660 Bug 34939 - Case insensitive link parsing (HttP://)
13661 !! input
13662 HttP://MediaWiki.Org/
13663 !! result
13664 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13665 </p>
13666 !! end
13667
13668 ###
13669 ### Parsoids-specific tests
13670 ### Parsoid-PHP parser incompatibilities
13671 ###
13672 !!test
13673 1. SOL-sensitive wikitext tokens as template-args
13674 !!options
13675 parsoid=wt2html,wt2wt
13676 !!input
13677 {{echo|*a}}
13678 {{echo|#a}}
13679 {{echo|:a}}
13680 !!result
13681 <span about="#mwt1" typeof="mw:Object/Template">
13682 </span><ul about="#mwt1"><li>a</li></ul>
13683 <span about="#mwt2" typeof="mw:Object/Template">
13684 </span><ol about="#mwt2"><li>a</li></ol>
13685 <span about="#mwt3" typeof="mw:Object/Template">
13686 </span><dl about="#mwt3"><dd>a</dd></dl>
13687 !!end
13688
13689 #### The following section of tests are primarily to test
13690 #### wikitext escaping capabilities of Parsoid. Given that
13691 #### escaping can be done any number of ways, the wikitext (input)
13692 #### is always adjusted to reflect how Parsoid adds nowiki
13693 #### escape tags.
13694 ####
13695 #### We are marking several tests as parsoid-only since the
13696 #### HTML in the result section is different from what the
13697 #### PHP parser generates for it.
13698
13699
13700 #### --------------- Headings ---------------
13701 #### 0. Unnested
13702 #### 1. Nested inside html <h1>=foo=</h1>
13703 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13704 #### 3. Nested inside html with wikitext split by html tags
13705 #### 4. No escape needed
13706 #### 5. Empty headings <h1></h1>
13707 #### 6. Heading chars in SOL context
13708 #### ----------------------------------------
13709 !! test
13710 Headings: 0. Unnested
13711 !! options
13712 parsoid
13713 !! input
13714 <nowiki>=foo=</nowiki>
13715
13716 <nowiki> =foo= </nowiki>
13717 <!--cmt-->
13718 <nowiki>=foo=</nowiki>
13719
13720 =foo''a''<nowiki>=</nowiki>
13721 !! result
13722 <p><span typeof="mw:Nowiki">=foo=</span></p>
13723
13724 <p><span typeof="mw:Nowiki"> =foo= </span>
13725 <!--cmt-->
13726 <span typeof="mw:Nowiki">=foo=</span></p>
13727
13728 <p>=foo<i>a</i><span typeof="mw:Nowiki">=</span></p>
13729 !!end
13730
13731 !! test
13732 Headings: 1. Nested inside html
13733 !! options
13734 parsoid
13735 !! input
13736 =<nowiki>=foo=</nowiki>=
13737 ==<nowiki>=foo=</nowiki>==
13738 ===<nowiki>=foo=</nowiki>===
13739 ====<nowiki>=foo=</nowiki>====
13740 =====<nowiki>=foo=</nowiki>=====
13741 ======<nowiki>=foo=</nowiki>======
13742 !! result
13743 <h1><span typeof="mw:Nowiki">=foo=</span></h1>
13744 <h2><span typeof="mw:Nowiki">=foo=</span></h2>
13745 <h3><span typeof="mw:Nowiki">=foo=</span></h3>
13746 <h4><span typeof="mw:Nowiki">=foo=</span></h4>
13747 <h5><span typeof="mw:Nowiki">=foo=</span></h5>
13748 <h6><span typeof="mw:Nowiki">=foo=</span></h6>
13749 !!end
13750
13751 !! test
13752 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13753 !! options
13754 parsoid
13755 !! input
13756 =foo=
13757 <nowiki>*bar</nowiki>
13758 =foo=
13759 =bar
13760 =foo=
13761 <nowiki>=bar=</nowiki>
13762 !! result
13763 <h1>foo</h1>*bar
13764 <h1>foo</h1>=bar
13765 <h1>foo</h1>=bar=
13766 !!end
13767
13768 !! test
13769 Headings: 3. Nested inside html with wikitext split by html tags
13770 !! options
13771 parsoid
13772 !! input
13773 =='''bold'''<nowiki>foo=</nowiki>=
13774 !! result
13775 <h1>=<b>bold</b><span typeof="mw:Nowiki">foo=</span></h1>
13776 !!end
13777
13778 !! test
13779 Headings: 4a. No escaping needed (testing just h1 and h2)
13780 !! options
13781 parsoid
13782 !! input
13783 ==foo=
13784 =foo==
13785 = =foo= =
13786 ==foo= bar=
13787 ===foo==
13788 ==foo===
13789 =''=''foo==
13790 =<nowiki>=</nowiki>=
13791 !! result
13792 <h1>=foo</h1>
13793 <h1>foo=</h1>
13794 <h1> =foo= </h1>
13795 <h1>=foo= bar</h1>
13796 <h2>=foo</h2>
13797 <h2>foo=</h2>
13798 <h1><i>=</i>foo=</h1>
13799 <h1><span typeof="mw:Nowiki">=</span></h1>
13800 !!end
13801
13802 !! test
13803 Headings: 4b. No escaping needed (inside p-tags)
13804 !! options
13805 parsoid
13806 !! input
13807 ===
13808 =foo= x
13809 =foo= <s></s>
13810 !! result
13811 <p>===
13812 =foo= x
13813 =foo= <s></s>
13814 </p>
13815 !!end
13816
13817 !! test
13818 Headings: 5. Empty headings
13819 !! options
13820 parsoid
13821 !! input
13822 =<nowiki/>=
13823 ==<nowiki/>==
13824 ===<nowiki/>===
13825 ====<nowiki/>====
13826 =====<nowiki/>=====
13827 ======<nowiki/>======
13828 !! result
13829 <h1></h1>
13830 <h2></h2>
13831 <h3></h3>
13832 <h4></h4>
13833 <h5></h5>
13834 <h6></h6>
13835 !!end
13836
13837 !! test
13838 Headings: 6. Heading chars in SOL context
13839 !! options
13840 parsoid
13841 !! input
13842 <!--cmt--><nowiki>=h1=</nowiki>
13843 <!--cmt--><nowiki> =h1= </nowiki>
13844 !! result
13845 <p><!--cmt--><span typeof="mw:Nowiki">=h1=</span>
13846 <!--cmt--><span typeof="mw:Nowiki"> =h1= </span></p>
13847 !!end
13848
13849 #### --------------- Lists ---------------
13850 #### 0. Outside nests (*foo, etc.)
13851 #### 1. Nested inside html <ul><li>*foo</li></ul>
13852 #### 2. Inside definition lists
13853 #### 3. Only bullets at start should be escaped
13854 #### 4. No escapes needed
13855 #### 5. No unnecessary escapes
13856 #### 6. Escape bullets in SOL position
13857 #### 7. Escape bullets in a multi-line context
13858 #### ----------------------------------------
13859
13860 !! test
13861 Lists: 0. Outside nests
13862 !! input
13863 <nowiki>*foo</nowiki>
13864
13865 <nowiki>#foo</nowiki>
13866 !! result
13867 <p>*foo
13868 </p><p>#foo
13869 </p>
13870 !!end
13871
13872 !! test
13873 Lists: 1. Nested inside html
13874 !! input
13875 *<nowiki>*foo</nowiki>
13876
13877 *<nowiki>#foo</nowiki>
13878
13879 *<nowiki>:foo</nowiki>
13880
13881 *<nowiki>;foo</nowiki>
13882
13883 #<nowiki>*foo</nowiki>
13884
13885 #<nowiki>#foo</nowiki>
13886
13887 #<nowiki>:foo</nowiki>
13888
13889 #<nowiki>;foo</nowiki>
13890 !! result
13891 <ul><li>*foo
13892 </li></ul>
13893 <ul><li>#foo
13894 </li></ul>
13895 <ul><li>:foo
13896 </li></ul>
13897 <ul><li>;foo
13898 </li></ul>
13899 <ol><li>*foo
13900 </li></ol>
13901 <ol><li>#foo
13902 </li></ol>
13903 <ol><li>:foo
13904 </li></ol>
13905 <ol><li>;foo
13906 </li></ol>
13907
13908 !!end
13909
13910 !! test
13911 Lists: 2. Inside definition lists
13912 !! input
13913 ;<nowiki>;foo</nowiki>
13914
13915 ;<nowiki>:foo</nowiki>
13916
13917 ;<nowiki>:foo</nowiki>
13918 :bar
13919
13920 :<nowiki>:foo</nowiki>
13921 !! result
13922 <dl><dt>;foo
13923 </dt></dl>
13924 <dl><dt>:foo
13925 </dt></dl>
13926 <dl><dt>:foo
13927 </dt><dd>bar
13928 </dd></dl>
13929 <dl><dd>:foo
13930 </dd></dl>
13931
13932 !!end
13933
13934 !! test
13935 Lists: 3. Only bullets at start of text should be escaped
13936 !! input
13937 *<nowiki>*foo*bar</nowiki>
13938
13939 *<nowiki>*foo</nowiki>''it''*bar
13940 !! result
13941 <ul><li>*foo*bar
13942 </li></ul>
13943 <ul><li>*foo<i>it</i>*bar
13944 </li></ul>
13945
13946 !!end
13947
13948 !! test
13949 Lists: 4. No escapes needed
13950 !! options
13951 parsoid
13952 !! input
13953 *foo*bar
13954
13955 *''foo''*bar
13956
13957 *[[Foo]]: bar
13958 !! result
13959 <ul><li>foo*bar
13960 </li></ul>
13961 <ul><li><i>foo</i>*bar
13962 </li></ul>
13963 <ul><li><a rel="mw:WikiLink" href="Foo">Foo</a>: bar
13964 </li></ul>
13965 !!end
13966
13967 !! test
13968 Lists: 5. No unnecessary escapes
13969 !! input
13970 * bar <span><nowiki>[[foo]]</nowiki></span>
13971
13972 *=bar <span><nowiki>[[foo]]</nowiki></span>
13973
13974 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13975
13976 *]]bar <span><nowiki>[[foo]]</nowiki></span>
13977
13978 *=bar <span>foo]]</span>=
13979
13980 * <s></s>: a
13981 !! result
13982 <ul><li> bar <span>[[foo]]</span>
13983 </li></ul>
13984 <ul><li>=bar <span>[[foo]]</span>
13985 </li></ul>
13986 <ul><li>[[bar <span>[[foo]]</span>
13987 </li></ul>
13988 <ul><li>]]bar <span>[[foo]]</span>
13989 </li></ul>
13990 <ul><li>=bar <span>foo]]</span>=
13991 </li></ul>
13992 <ul><li> <s></s>: a
13993 </li></ul>
13994
13995 !!end
13996
13997 !! test
13998 Lists: 6. Escape bullets in SOL position
13999 !! options
14000 parsoid
14001 !! input
14002 <!--cmt--><nowiki>*foo</nowiki>
14003 !! result
14004 <p><!--cmt--><span typeof="mw:Nowiki">*foo</span></p>
14005 !!end
14006
14007 !! test
14008 Lists: 7. Escape bullets in a multi-line context
14009 !! input
14010 <nowiki>a
14011 *b</nowiki>
14012 !! result
14013 <p>a
14014 *b
14015 </p>
14016 !!end
14017
14018 #### --------------- HRs ---------------
14019 #### 1. Single line
14020 #### -----------------------------------
14021
14022 !! test
14023 HRs: 1. Single line
14024 !! options
14025 parsoid
14026 !! input
14027 ----<nowiki>----</nowiki>
14028 ----=foo=
14029 ----*foo
14030 !! result
14031 <hr><span typeof="mw:Nowiki">----</span>
14032 <hr>=foo=
14033 <hr>*foo
14034 !! end
14035
14036 #### --------------- Tables ---------------
14037 #### 1a. Simple example
14038 #### 1b. No escaping needed (!foo)
14039 #### 1c. No escaping needed (|foo)
14040 #### 1d. No escaping needed (|}foo)
14041 ####
14042 #### 2a. Nested in td (<td>foo|bar</td>)
14043 #### 2b. Nested in td (<td>foo||bar</td>)
14044 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14045 ####
14046 #### 3a. Nested in th (<th>foo!bar</th>)
14047 #### 3b. Nested in th (<th>foo!!bar</th>)
14048 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14049 ####
14050 #### 4a. Escape -
14051 #### 4b. Escape +
14052 #### 4c. No escaping needed
14053 #### --------------------------------------
14054
14055 !! test
14056 Tables: 1a. Simple example
14057 !! input
14058 <nowiki>{|
14059 |}</nowiki>
14060 !! result
14061 <p>{|
14062 |}
14063 </p>
14064 !! end
14065
14066 !! test
14067 Tables: 1b. No escaping needed
14068 !! input
14069 !foo
14070 !! result
14071 <p>!foo
14072 </p>
14073 !! end
14074
14075 !! test
14076 Tables: 1c. No escaping needed
14077 !! input
14078 |foo
14079 !! result
14080 <p>|foo
14081 </p>
14082 !! end
14083
14084 !! test
14085 Tables: 1d. No escaping needed
14086 !! input
14087 |}foo
14088 !! result
14089 <p>|}foo
14090 </p>
14091 !! end
14092
14093 !! test
14094 Tables: 2a. Nested in td
14095 !! options
14096 parsoid
14097 !! input
14098 {|
14099 |<nowiki>foo|bar</nowiki>
14100 |}
14101 !! result
14102 <table><tbody><tr>
14103 <td><span typeof="mw:Nowiki">foo|bar</span></td></tr></tbody></table>
14104 !! end
14105
14106 !! test
14107 Tables: 2b. Nested in td
14108 !! options
14109 parsoid
14110 !! input
14111 {|
14112 |<nowiki>foo||bar</nowiki>
14113 |''it''<nowiki>foo||bar</nowiki>
14114 |}
14115 !! result
14116 <table><tbody><tr>
14117 <td><span typeof="mw:Nowiki">foo||bar</span></td>
14118 <td><i>it</i><span typeof="mw:Nowiki">foo||bar</span></td></tr></tbody></table>
14119 !! end
14120
14121 !! test
14122 Tables: 2c. Nested in td -- no escaping needed
14123 !! options
14124 parsoid
14125 !! input
14126 {|
14127 |foo!!bar
14128 |}
14129 !! result
14130 <table><tbody><tr><td>foo!!bar
14131 </td></tr></tbody></table>
14132
14133 !! end
14134
14135 !! test
14136 Tables: 3a. Nested in th
14137 !! options
14138 parsoid
14139 !! input
14140 {|
14141 !foo!bar
14142 |}
14143 !! result
14144 <table><tbody><tr><th>foo!bar
14145 </th></tr></tbody></table>
14146
14147 !! end
14148
14149 !! test
14150 Tables: 3b. Nested in th
14151 !! options
14152 parsoid
14153 !! input
14154 {|
14155 !<nowiki>foo!!bar</nowiki>
14156 |}
14157 !! result
14158 <table>
14159 <tbody><tr><th><span typeof="mw:Nowiki">foo!!bar</span></th></tr>
14160 </tbody></table>
14161 !! end
14162
14163 !! test
14164 Tables: 3c. Nested in th -- no escaping needed
14165 !! options
14166 parsoid
14167 !! input
14168 {|
14169 !<nowiki>foo||bar</nowiki>
14170 |}
14171 !! result
14172 <table><tbody><tr>
14173 <th><span typeof="mw:Nowiki">foo||bar</span></th></tr></tbody></table>
14174 !! end
14175
14176 !! test
14177 Tables: 4a. Escape -
14178 !! options
14179 parsoid
14180 !! input
14181 {|
14182 |-
14183 !-bar
14184 |-
14185 |<nowiki>-bar</nowiki>
14186 |}
14187 !! result
14188 <table><tbody>
14189 <tr><th>-bar</th></tr>
14190 <tr>
14191 <td><span typeof="mw:Nowiki">-bar</span></td></tr></tbody></table>
14192 !! end
14193
14194 !! test
14195 Tables: 4b. Escape +
14196 !! options
14197 parsoid
14198 !! input
14199 {|
14200 |-
14201 !+bar
14202 |-
14203 |<nowiki>+bar</nowiki>
14204 |}
14205 !! result
14206 <table><tbody>
14207 <tr><th>+bar</th></tr>
14208 <tr>
14209 <td><span typeof="mw:Nowiki">+bar</span></td></tr></tbody></table>
14210 !! end
14211
14212 !! test
14213 Tables: 4c. No escaping needed
14214 !! options
14215 parsoid
14216 !! input
14217 {|
14218 |-
14219 |foo-bar
14220 |foo+bar
14221 |-
14222 |''foo''-bar
14223 |''foo''+bar
14224 |}
14225 !! result
14226 <table><tbody>
14227 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14228 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14229 </tbody></table>
14230 !! end
14231
14232 ### SSS FIXME: Disabled right now because accurate html2wt
14233 ### on this snippet requires data-parsoid flags that we've
14234 ### stripped out of these tests. We should scheme how we
14235 ### we want to handle these kind of tests that require
14236 ### data-parsoid flags for accurate html2wt serialization
14237
14238 !! test
14239 Tables: 4d. No escaping needed
14240 !! options
14241 disabled
14242 !! input
14243 {|
14244 ||+1
14245 ||-2
14246 |}
14247 !! result
14248 <table>
14249 <tr>
14250 <td>+1
14251 </td>
14252 <td>-2
14253 </td></tr></table>
14254
14255 !! end
14256
14257 #### --------------- Links ---------------
14258 #### 1. Quote marks in link text
14259 #### 2. Wikilinks: Escapes needed
14260 #### 3. Wikilinks: No escapes needed
14261 #### 4. Extlinks: Escapes needed
14262 #### 5. Extlinks: No escapes needed
14263 #### --------------------------------------
14264 !! test
14265 Links 1. Quote marks in link text
14266 !! options
14267 parsoid
14268 !! input
14269 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14270 !! result
14271 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14272 !! end
14273
14274 !! test
14275 Links 2. WikiLinks: Escapes needed
14276 !! options
14277 parsoid
14278 !! input
14279 [[Foo|<nowiki>[Foobar]</nowiki>]]
14280 [[Foo|<nowiki>Foobar]</nowiki>]]
14281 [[Foo|x [Foobar] x]]
14282 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14283 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14284 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14285 [[Foo|<nowiki>|Bar</nowiki>]]
14286 [[Foo|<nowiki>]]bar</nowiki>]]
14287 [[Foo|<nowiki>[[bar</nowiki>]]
14288 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14289 !! result
14290 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14291 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14292 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14293 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14294 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14295 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14296 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14297 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14298 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14299 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14300 !! end
14301
14302 !! test
14303 Links 3. WikiLinks: No escapes needed
14304 !! options
14305 parsoid
14306 !! input
14307 [[Foo|[Foobar]]
14308 [[Foo|foo|bar]]
14309 !! result
14310 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14311 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14312 !! end
14313
14314 !! test
14315 Links 4. ExtLinks: Escapes needed
14316 !! options
14317 parsoid
14318 !! input
14319 [http://google.com <nowiki>[google]</nowiki>]
14320 [http://google.com <nowiki>google]</nowiki>]
14321 !! result
14322 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14323 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14324 !! end
14325
14326 !! test
14327 Links 5. ExtLinks: No escapes needed
14328 !! options
14329 parsoid
14330 !! input
14331 [http://google.com [google]
14332 !! result
14333 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14334 !! end
14335
14336 #### --------------- Quotes ---------------
14337 #### 1. Quotes inside <b> and <i>
14338 #### 2. Link fragments separated by <i> and <b> tags
14339 #### 3. Link fragments inside <i> and <b>
14340 #### --------------------------------------
14341 !! test
14342 1. Quotes inside <b> and <i>
14343 !! input
14344 ''<nowiki>'foo'</nowiki>''
14345 ''<nowiki>''foo''</nowiki>''
14346 ''<nowiki>'''foo'''</nowiki>''
14347 '''<nowiki>'foo'</nowiki>'''
14348 '''<nowiki>''foo''</nowiki>'''
14349 '''<nowiki>'''foo'''</nowiki>'''
14350 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14351 !! result
14352 <p><i>'foo'</i>
14353 <i>''foo''</i>
14354 <i>'''foo'''</i>
14355 <b>'foo'</b>
14356 <b>''foo''</b>
14357 <b>'''foo'''</b>
14358 <b>foo'<i>bar'</i>baz</b>
14359 </p>
14360 !! end
14361
14362 !! test
14363 2. Link fragments separated by <i> and <b> tags
14364 !! input
14365 [[''foo''<nowiki>hello]]</nowiki>
14366
14367 [['''foo'''<nowiki>hello]]</nowiki>
14368 !! result
14369 <p>[[<i>foo</i>hello]]
14370 </p><p>[[<b>foo</b>hello]]
14371 </p>
14372 !! end
14373
14374 !! test
14375 2. Link fragments inside <i> and <b>
14376 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14377 this is one of the shortcomings of this format)
14378 !! input
14379 ''[[foo''<nowiki>]]</nowiki>
14380
14381 '''[[foo'''<nowiki>]]</nowiki>
14382 !! result
14383 <p><i>[[foo</i>]]
14384 </p><p><b>[[foo</b>]]
14385 </p>
14386 !! end
14387
14388 #### --------------- Paragraphs ---------------
14389 #### 1. No unnecessary escapes
14390 #### --------------------------------------
14391
14392 !! test
14393 1. No unnecessary escapes
14394 !! input
14395 bar <span><nowiki>[[foo]]</nowiki></span>
14396
14397 =bar <span><nowiki>[[foo]]</nowiki></span>
14398
14399 [[bar <span><nowiki>[[foo]]</nowiki></span>
14400
14401 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14402
14403 =bar <span>foo]]</span><nowiki>=</nowiki>
14404 !! result
14405 <p>bar <span>[[foo]]</span>
14406 </p><p>=bar <span>[[foo]]</span>
14407 </p><p>[[bar <span>[[foo]]</span>
14408 </p><p>]]bar <span>[[foo]]</span>
14409 </p><p>=bar <span>foo]]</span>=
14410 </p>
14411 !!end
14412
14413 #### --------------- PRE ------------------
14414 #### 1. Leading space in SOL context should be escaped
14415 #### --------------------------------------
14416 !! test
14417 1. Leading space in SOL context should be escaped
14418 !! options
14419 parsoid
14420 !! input
14421 <nowiki> foo</nowiki>
14422 <!--cmt--><nowiki> foo</nowiki>
14423 !! result
14424 <p> foo
14425 <!--cmt--> foo
14426 </p>
14427 !! end
14428
14429 #### --------------- HTML tags ---------------
14430 #### 1. a tags
14431 #### 2. other tags
14432 #### 3. multi-line html tag
14433 #### --------------------------------------
14434 !! test
14435 1. a tags
14436 !! options
14437 parsoid
14438 !! input
14439 <a href="http://google.com">google</a>
14440 !! result
14441 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14442 !! end
14443
14444 !! test
14445 2. other tags
14446 !! input
14447 <nowiki><div>foo</div>
14448 <div style="color:red">foo</div></nowiki>
14449 !! result
14450 <p>&lt;div&gt;foo&lt;/div&gt;
14451 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14452 </p>
14453 !! end
14454
14455 !! test
14456 3. multi-line html tag
14457 !! input
14458 <nowiki><div
14459 >foo</div
14460 ></nowiki>
14461 !! result
14462 <p>&lt;div
14463 &gt;foo&lt;/div
14464 &gt;
14465 </p>
14466 !! end
14467
14468 #### --------------- Others ---------------
14469 !! test
14470 Escaping nowikis
14471 !! input
14472 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14473 !! result
14474 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14475 </p>
14476 !! end
14477 !! test
14478
14479 Tag-like HTML structures are passed through as text
14480 !! input
14481 <x y>
14482
14483 <x.y>
14484
14485 <x-y>
14486
14487 1>2
14488
14489 x<y
14490
14491 a>b
14492
14493 1<d e>f
14494 !! result
14495 <p>&lt;x y&gt;
14496 </p><p>&lt;x.y&gt;
14497 </p><p>&lt;x-y&gt;
14498 </p><p>1&gt;2
14499 </p><p>x&lt;y
14500 </p><p>a&gt;b
14501 </p><p>1&lt;d e&gt;f
14502 </p>
14503 !! end
14504
14505
14506 # This fails in the PHP parser (see bug 40670,
14507 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14508 !! test
14509 Tag names followed by punctuation should not be recognized as tags
14510 !! options
14511 parsoid
14512 !! input
14513 <s.ome> text
14514 !! result
14515 <p>&lt;s.ome&gt; text
14516 </p>
14517 !! end
14518
14519 !! test
14520 HTML tag with necessary entities in attributes
14521 !! input
14522 <span title="&amp;amp;">foo</span>
14523 !! result
14524 <p><span title="&amp;amp;">foo</span>
14525 </p>
14526 !! end
14527
14528 !! test
14529 HTML tag with 'unnecessary' entity encoding in attributes
14530 !! input
14531 <span title="&amp;">foo</span>
14532 !! result
14533 <p><span title="&amp;">foo</span>
14534 </p>
14535 !! end
14536
14537 !! test
14538 HTML tag with broken attribute value quoting
14539 !! input
14540 <span title="Hello world>Foo</span>
14541 !! result
14542 <p><span>Foo</span>
14543 </p>
14544 !! end
14545
14546 !! test
14547 Parsoid-only: HTML tag with broken attribute value quoting
14548 !! options
14549 parsoid
14550 !! input
14551 <span title="Hello world>Foo</span>
14552 !! result
14553 <p><span title="Hello world">Foo</span>
14554 </p>
14555 !! end
14556
14557 !! test
14558 Table with broken attribute value quoting
14559 !! input
14560 {|
14561 | title="Hello world|Foo
14562 |}
14563 !! result
14564 <table>
14565 <tr>
14566 <td>Foo
14567 </td></tr></table>
14568
14569 !! end
14570
14571 !! test
14572 Table with broken attribute value quoting on consecutive lines
14573 !! input
14574 {|
14575 | title="Hello world|Foo
14576 | style="color:red|Bar
14577 |}
14578 !! result
14579 <table>
14580 <tr>
14581 <td>Foo
14582 </td>
14583 <td>Bar
14584 </td></tr></table>
14585
14586 !! end
14587
14588 !! test
14589 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14590 !! options
14591 parsoid
14592 !! input
14593 {|
14594 | title="Hello world|Foo
14595 | style="color:red|Bar
14596 |}
14597 !! result
14598 <table><tbody>
14599 <tr>
14600 <td title="Hello world">Foo
14601 </td><td style="color: red">Bar
14602 </td></tr></tbody></table>
14603
14604 !! end
14605
14606 !! test
14607 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14608 !! options
14609 parsoid
14610 !! input
14611 {{}}
14612 !! result
14613 {{}}
14614 !! end
14615
14616 !! test
14617 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14618 !! options
14619 parsoid
14620 !! input
14621 }}{{
14622 !! result
14623 }}{{
14624 !! end
14625
14626 !!test
14627 Accept empty td cell attribute
14628 !!input
14629 {|
14630 | align="center" | foo || |
14631 |}
14632 !!result
14633 <table>
14634 <tr>
14635 <td align="center"> foo </td>
14636 <td>
14637 </td></tr></table>
14638
14639 !!end
14640
14641 !!test
14642 Non-empty attributes in th-cells
14643 !!input
14644 {|
14645 ! Foo !! style="color: red" | Bar
14646 |}
14647 !!result
14648 <table>
14649 <tr>
14650 <th> Foo </th>
14651 <th style="color: red"> Bar
14652 </th></tr></table>
14653
14654 !!end
14655
14656 !!test
14657 Accept empty attributes in th-cells
14658 !!input
14659 {|
14660 !| foo !!| bar
14661 |}
14662 !!result
14663 <table>
14664 <tr>
14665 <th> foo </th>
14666 <th> bar
14667 </th></tr></table>
14668
14669 !!end
14670
14671 !!test
14672 Empty table rows go away
14673 !!input
14674 {|
14675 | Hello
14676 | there
14677 |- class="foo"
14678 |-
14679 |}
14680 !! result
14681 <table>
14682 <tr>
14683 <td> Hello
14684 </td>
14685 <td> there
14686 </td></tr>
14687
14688 </table>
14689
14690 !! end
14691
14692 ###
14693 ### Parsoid-centric tests for testing RTing of inter-element separators
14694 ### Edge cases not tested by existing parser tests and specific to
14695 ### Parsoid-specific serialization strategies.
14696 ###
14697
14698 !!test
14699 RT-ed inter-element separators should be valid separators
14700 !!input
14701 {|
14702 |- [[foo]]
14703 |}
14704 !!result
14705 <table>
14706
14707 </table>
14708
14709 !!end
14710
14711 !!test
14712 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14713 (Parsoid-only since PHP parser relies on Tidy for correct output)
14714 !!options
14715 parsoid
14716 !!input
14717 {|
14718 |<small>foo
14719 bar
14720 |}
14721
14722 {|
14723 |<small>foo<small>
14724 |}
14725 !!result
14726 !!end
14727
14728 !!test
14729 Empty TD followed by TD with tpl-generated attribute
14730 !!input
14731 {|
14732 |-
14733 |
14734 |{{echo|style='color:red'}}|foo
14735 |}
14736 !!result
14737 <table>
14738
14739 <tr>
14740 <td>
14741 </td>
14742 <td>foo
14743 </td></tr></table>
14744
14745 !!end
14746
14747 !!test
14748 Indented table with an empty td
14749 !!input
14750 {|
14751 |-
14752 |
14753 |foo
14754 |}
14755 !!result
14756 <table>
14757
14758 <tr>
14759 <td>
14760 </td>
14761 <td>foo
14762 </td></tr></table>
14763
14764 !!end
14765
14766 !!test
14767 Empty TR followed by a template-generated TR
14768 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14769 !!options
14770 parsoid=wt2html,wt2wt
14771 !!input
14772 {|
14773 |-
14774 {{echo|<tr><td>foo</td></tr>}}
14775 |}
14776 !!result
14777 <table>
14778 <tbody>
14779 <tr></tr>
14780 <tr typeof="mw:Object/Template">
14781 <td>foo</td></tr></tbody></table>
14782 !!end
14783
14784 ## PHP and parsoid output differ for this, and since this is primarily
14785 ## for testing Parsoid's serializer, marking this Parsoid only
14786 !!test
14787 Empty TR followed by mixed-ws-comment line should RT correctly
14788 !!options
14789 parsoid
14790 !!input
14791 {|
14792 |-
14793 <!--c-->
14794 |-
14795 <!--c--> <!--d-->
14796 |}
14797 !!result
14798 <table>
14799 <tbody>
14800 <tr>
14801 <td> <!--c--></td></tr>
14802 <tr>
14803 <td><!--c--> <!--d--></td></tr>
14804 </tbody></table>
14805
14806 !!end
14807
14808 !!test
14809 Multi-line image caption generated by templates with/without trailing newlines
14810 !!options
14811 parsoid
14812 !!input
14813 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14814 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14815 !!result
14816 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14817 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14818
14819 !!end
14820
14821 ## PHP emits broken html for this, and since this is primarily
14822 ## a Parsoid serializer test, marking this Parsoid only
14823 !!test
14824 Improperly nested inline or quotes tags with whitespace in between
14825 !!options
14826 parsoid
14827 !!input
14828 <span> <s>x</span> </s>
14829 ''' ''x''' ''
14830 !!result
14831 <p><span> <s>x</s></span><s> </s>
14832 <b> <i>x</i></b><i> </i>
14833 </p>
14834 !!end
14835
14836 TODO:
14837 more images
14838 more tables
14839 character entities
14840 and much more
14841 Try for 100% code coverage